00001 //*****************************************************************************// 00002 // // 00003 // Copyright (c) 2001 // 00004 // INRIA // 00005 // 54600 VILLERS LES NANCY // 00006 // France // 00007 // // 00008 //*****************************************************************************// 00009 // // 00010 // *** NOTICE OF PROPRIETARY INFORMATION *** // 00011 // // 00012 // The information contained in this file is considered proprietary and the // 00013 // exclusive property of INRIA. This information may not be disclosed, // 00014 // duplicated or used, in whole or in part, for any purpose whatsoever // 00015 // without express written authorization from INRIA // 00016 // // 00017 //*****************************************************************************// 00018 00019 00020 #ifndef QC_MEMORY_H_ 00021 #define QC_MEMORY_H_ 00022 00023 00024 #include "QCCommon.hpp" 00025 00026 00027 00033 class QCMemory 00034 { 00035 00037 public: 00041 QCMemory (void); 00042 00046 ~QCMemory (void); 00047 00048 00054 template <class TP> 00055 TP* takeTmpMem (const int& nb); 00056 00062 template <class TP> 00063 bool giveBackTmpMem (TP *QCRestrict & tmpMemPtr); 00064 00069 bool updateBlockTmpMem (void); 00070 00074 void disallocateBlockTmpMem (void); 00075 00076 00081 void evaluateUsedMemory (void); 00082 00086 void printUsedMemoryMax (void); 00087 00091 void printQCMemory (void); 00092 00096 QCFloat getUsedMemoryMax (void); 00097 00101 bool setUsedMemoryMax (const int size); 00102 00103 00104 00106 protected: 00107 00108 00110 private: 00111 00112 00115 public: 00116 protected: 00117 private: 00118 00123 struct QCStackCell { 00127 QCFloat* memPtr; 00131 int memSize; 00132 }; 00133 00137 int curTmpMem; 00138 00143 int maxTmpMem; 00144 00149 QCFloat* blockTmpMem; 00150 00154 QCFloat* freeMemPtr; 00155 00159 QCFloat* endOfBlock; 00160 00165 int blockSize; 00166 00170 QCStackCell* stackPtr; 00171 00175 int stackPtrIndex; 00176 00180 int stackPtrMaxIndex; 00181 00182 }; 00183 00184 #endif // QC_MEMORY_H