Changeset 12737
- Timestamp:
- 12/22/11 15:47:41 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Mars/mcore/fits.h
r12732 r12737 15 15 #ifdef __CINT__ 16 16 #define off_t size_t 17 #else 18 #include <unordered_map> 17 19 #endif 18 20 … … 399 401 Addresses fAddresses; 400 402 403 #ifdef __CINT__ 404 typedef map<string, void*> Pointers; 405 #else 406 typedef unordered_map<string, void*> Pointers; 407 #endif 408 Pointers fPointers; 409 410 vector<vector<char>> fGarbage; 411 401 412 vector<char> fBufferRow; 402 413 vector<char> fBufferDat; … … 614 625 } 615 626 627 template<class T, class S> 628 const T &GetAs(const string &name) 629 { 630 return *reinterpret_cast<S*>(fPointers[name]); 631 } 632 633 void *SetPtrAddress(const string &name) 634 { 635 if (fTable.cols.count(name)==0) 636 { 637 ostringstream str; 638 str <<"SetPtrAddress('" << name << "') - Column not found." << endl; 639 #ifdef __EXCEPTIONS 640 throw runtime_error(str.str()); 641 #else 642 gLog << ___err___ << "ERROR - " << str.str() << endl; 643 return NULL; 644 #endif 645 } 646 647 fGarbage.push_back(vector<char>(fTable.cols[name].size*fTable.cols[name].num)); 648 649 void *ptr = fGarbage.back().data(); 650 651 fPointers[name] = ptr; 652 fAddresses.push_back(make_pair(ptr, fTable.cols[name])); 653 sort(fAddresses.begin(), fAddresses.end(), Compare); 654 return ptr; 655 } 656 616 657 template<typename T> 617 658 bool SetPtrAddress(const string &name, T *ptr, size_t cnt) … … 659 700 660 701 //fAddresses[ptr] = fTable.cols[name]; 702 fPointers[name] = ptr; 661 703 fAddresses.push_back(make_pair(ptr, fTable.cols[name])); 662 704 sort(fAddresses.begin(), fAddresses.end(), Compare); … … 706 748 707 749 //fAddresses[ptr] = fTable.cols[name]; 750 fPointers[name] = ptr; 708 751 fAddresses.push_back(make_pair(ptr, fTable.cols[name])); 709 752 sort(fAddresses.begin(), fAddresses.end(), Compare); … … 713 756 bool HasKey(const string &key) const { return fTable.HasKey(key); } 714 757 bool HasColumn(const string& col) const { return fTable.HasColumn(col);} 715 const Table::Columns &GetColumns() const { return fTable. getColumns();}716 const Table::Keys &GetKeys() const { return fTable. getKeys();}758 const Table::Columns &GetColumns() const { return fTable.GetColumns();} 759 const Table::Keys &GetKeys() const { return fTable.GetKeys();} 717 760 718 761 int64_t GetInt(const string &key) const { return fTable.Get<int64_t>(key); }
Note:
See TracChangeset
for help on using the changeset viewer.