![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /********************************************************************* 00002 ** Copyright (c) 1999 MaK Technologies, Inc. 00003 ** All rights reserved. 00004 *********************************************************************/ 00005 /********************************************************************* 00006 ** $RCSfile: memMgr.h,v $ $Revision: 1.9 $ $State: Exp $ 00007 *********************************************************************/ 00008 00009 #ifndef memMgr_H_ 00010 #define memMgr_H_ 00011 00012 #include "gdb/gdbDefines.h" 00013 #include <vlutil/vlList.h> 00014 00015 // forward declarations 00016 class DtPolygonIndirect; 00017 class DtTriangleIndirect; 00018 class DtExtentTriangleIndirect; 00019 class DtGroup; 00020 class DtStaticCoordinateSystem; 00021 class DtGdbCulturalFeature; 00022 class DtTerrainFeature; 00023 class DtBuilding; 00024 class DtTree; 00025 class DtRefGroup; 00026 00027 // class DtMemoryManager: 00028 // 00029 // DtMemoryManager is a class that manages the allocation of nodes 00030 // of certain types: indirect polygons, groups and features 00031 // of various kinds. 00032 00033 class DT_DLL_gdb DtMemoryManager 00034 { 00035 public: 00036 00037 // default constructor 00038 DtMemoryManager(); 00039 00040 // destructor 00041 virtual ~DtMemoryManager(); 00042 00043 // returns a newly allocated DtPolygonIndirect 00044 // \throws std::bad_alloc if there is not enough memory to allocate 00045 virtual DtPolygonIndirect* allocatePolyIndirect(); 00046 00047 // returns a newly allocated DtPolygonIndirect 00048 // \throws std::bad_alloc if there is not enough memory to allocate 00049 virtual DtPolygonIndirect* allocatePolyIndirect(int n); 00050 00051 // returns a newly allocated DtTriangleIndirect 00052 // \throws std::bad_alloc if there is not enough memory to allocate 00053 virtual DtTriangleIndirect* allocateTriIndirect(); 00054 00055 // returns a newly allocated DtExtentTriangleIndirect 00056 // \throws std::bad_alloc if there is not enough memory to allocate 00057 virtual DtExtentTriangleIndirect* allocateExtentTriIndirect(); 00058 00059 // returns a newly allocated DtGroup 00060 // \throws std::bad_alloc if there is not enough memory to allocate 00061 virtual DtGroup* allocateGroup(); 00062 00063 // returns a newly allocated DtStaticCoordinateSystem 00064 // \throws std::bad_alloc if there is not enough memory to allocate 00065 virtual DtStaticCoordinateSystem* allocateStaticCoordSystem(); 00066 00067 // returns a newly allocated DtGdbCulturalFeature 00068 // \throws std::bad_alloc if there is not enough memory to allocate 00069 virtual DtGdbCulturalFeature* allocateCulturalFeature(); 00070 00071 // returns a newly allocated DtTerrainFeature 00072 // \throws std::bad_alloc if there is not enough memory to allocate 00073 virtual DtTerrainFeature* allocateTerrainFeature(); 00074 00075 // returns a newly allocated building 00076 // \throws std::bad_alloc if there is not enough memory to allocate 00077 virtual DtBuilding* allocateBuilding(); 00078 00079 // returns a newly allocated tree 00080 // \throws std::bad_alloc if there is not enough memory to allocate 00081 virtual DtTree* allocateTree(); 00082 00083 // returns a newly allocated DtRefGroup 00084 // \throws std::bad_alloc if there is not enough memory to allocate 00085 virtual DtRefGroup* allocateRefGroup(); 00086 00087 // returns an array of integers of the specified size. 00088 // \throws std::bad_alloc if there is not enough memory to allocate 00089 virtual int* allocateIndexArray(int n); 00090 00091 virtual int sizeInBytes() const; 00092 00093 protected: 00094 00095 // copy constructor 00096 DtMemoryManager(const DtMemoryManager& orig); 00097 00098 // assignment operator 00099 DtMemoryManager& operator=(const DtMemoryManager& orig); 00100 00101 protected: 00102 00103 static int theNumberOfPolyIndPerBucket; 00104 static int theNumberOfTriIndPerBucket; 00105 static int theNumberOfExtentTriIndPerBucket; 00106 static int theNumberOfGroupsPerBucket; 00107 static int theNumberOfStaticCoordSysPerBucket; 00108 static int theNumberOfCulturalFeaturesPerBucket; 00109 static int theNumberOfTerrainFeaturesPerBucket; 00110 static int theNumberOfBuildingsPerBucket; 00111 static int theNumberOfTreesPerBucket; 00112 static int theNumberOfRefGroupsPerBucket; 00113 static int theNumberOfIndicesPerBucket; 00114 00115 protected: 00116 00117 DtList myPolyIndBuckets; 00118 DtList myExtentTriIndBuckets; 00119 DtList myTriIndBuckets; 00120 DtList myGroupBuckets; 00121 DtList myStatCoordSysBuckets; 00122 DtList myCulturalFeatureBuckets; 00123 DtList myTerrainFeatureBuckets; 00124 DtList myBuildingBuckets; 00125 DtList myTreeBuckets; 00126 DtList myRefGroupBuckets; 00127 DtList myIndexBuckets; 00128 00129 int myRemainingPolyIndInCurrBucket; 00130 int myRemainingExtentTriIndInCurrBucket; 00131 int myRemainingTriIndInCurrBucket; 00132 int myRemainingGroupsInCurrBucket; 00133 int myRemainingStatCoordSysInCurrBucket; 00134 int myRemainingCulturalFeaturesInCurrBucket; 00135 int myRemainingTerrainFeaturesInCurrBucket; 00136 int myRemainingBuildingsInCurrBucket; 00137 int myRemainingTreesInCurrBucket; 00138 int myRemainingRefGroupsInCurrBucket; 00139 int myRemainingIndicesInCurrBucket; 00140 }; 00141 00142 #endif