Changeset dfed1c for src/base/has_tempgrids.hpp
- Timestamp:
- Nov 22, 2011, 9:22:10 PM (14 years ago)
- Children:
- facba0
- Parents:
- 66f24d
- File:
-
- 1 edited
-
src/base/has_tempgrids.hpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/base/has_tempgrids.hpp
r66f24d rdfed1c 3 3 * @author Julian Iseringhausen <isering@ins.uni-bonn.de> 4 4 * @date Tue Apr 5 21:00:56 2011 5 * 5 * 6 6 * @brief Provides an arbitrary number of temporary grids, 7 7 * accessible by an integer key. 8 * 8 * 9 9 */ 10 10 … … 25 25 virtual ~HasTempGrids() 26 26 { 27 for (std::map<int, VMG::TempGrid*>::iterator iter = grids.begin(); iter != grids.end(); ++iter) 27 for (std::map<int, TempGrid*>::iterator iter = grids_1.begin(); iter != grids_1.end(); ++iter) 28 delete iter->second; 29 30 for (std::map<const Grid*, TempGrid*>::iterator iter = grids_2.begin(); iter != grids_2.end(); ++iter) 28 31 delete iter->second; 29 32 } 30 33 31 34 protected: 32 VMG::TempGrid* GetTempGrid(int key)35 TempGrid* GetTempGrid(int key) 33 36 { 34 std::map<int, VMG::TempGrid*>::iterator iter = grids.find(key);37 std::map<int, TempGrid*>::iterator iter = grids_1.find(key); 35 38 36 if (iter != grids.end()) 37 return iter->second; 38 else { 39 VMG::TempGrid* temp = new VMG::TempGrid(); 40 grids.insert(std::pair<int,VMG::TempGrid*>(key, temp)); 41 return temp; 42 } 39 if (iter == grids_1.end()) 40 iter = grids_1.insert(std::pair<int, TempGrid*>(key, new TempGrid())).first; 41 42 return iter->second; 43 } 44 45 TempGrid* GetTempGrid(const Grid* key) 46 { 47 std::map<const Grid*, TempGrid*>::iterator iter = grids_2.find(key); 48 49 if (iter == grids_2.end()) 50 iter = grids_2.insert(std::pair<const Grid*, TempGrid*>(key, new TempGrid())).first; 51 52 return iter->second; 43 53 } 44 54 45 55 private: 46 std::map<int,VMG::TempGrid*> grids; 56 std::map<int, TempGrid*> grids_1; 57 std::map<const Grid*, TempGrid*> grids_2; 47 58 }; 48 59
Note:
See TracChangeset
for help on using the changeset viewer.
