QCMemory Class Reference

#include <QCMemory.hpp>

List of all members.


Detailed Description

class QCMemory

Definition at line 33 of file QCMemory.hpp.

Public Member Functions

void disallocateBlockTmpMem (void)
void evaluateUsedMemory (void)
QCFloat getUsedMemoryMax (void)
template<class TP>
bool giveBackTmpMem (TP *QCRestrict &tmpMemPtr)
template<class TP>
bool giveBackTmpMem (TP *__restrict__ &tmpMemPtr)
void printQCMemory (void)
void printUsedMemoryMax (void)
 QCMemory (void)
bool setUsedMemoryMax (const int size)
template<class TP>
TP * takeTmpMem (const int &nb)
bool updateBlockTmpMem (void)
 ~QCMemory (void)

Private Attributes

int blockSize
QCFloatblockTmpMem
int curTmpMem
QCFloatendOfBlock
QCFloatfreeMemPtr
int maxTmpMem
QCStackCellstackPtr
int stackPtrIndex
int stackPtrMaxIndex

Classes

struct  QCStackCell


Constructor & Destructor Documentation

QCMemory::QCMemory void   ) 
 

Definition at line 29 of file QCMemory.cpp.

QCMemory::~QCMemory void   ) 
 

Definition at line 36 of file QCMemory.cpp.

References disallocateBlockTmpMem().

Here is the call graph for this function:


Member Function Documentation

void QCMemory::disallocateBlockTmpMem void   ) 
 

Disallocation of that memory block.

Definition at line 264 of file QCMemory.cpp.

References blockSize, blockTmpMem, maxTmpMem, stackPtr, QCErrorManager::UNOPTIMAL_TMP_MEM, QCErrorManager::WARNING, and QCErrorManager::writeMsg().

Referenced by ~QCMemory().

Here is the call graph for this function:

void QCMemory::evaluateUsedMemory void   ) 
 

Evaluation of the amount of RAM used by the application. The result is stored in a temporary file.

Definition at line 303 of file QCMemory.cpp.

References QCCommon::MemoryTmpFile, and QCCommon::Pid.

Referenced by QCManager< TPModel, TPSystem >::runComputations().

QCFloat QCMemory::getUsedMemoryMax void   ) 
 

Return the maximum amount of used RAM.

Definition at line 323 of file QCMemory.cpp.

References QCCommon::MemoryTmpFile, QCCommon::outdir, PATH_SEPARATOR(), QC1024, and QCCStrLen_32.

Here is the call graph for this function:

template<class TP>
bool QCMemory::giveBackTmpMem TP *QCRestrict &  tmpMemPtr  ) 
 

Ok, c est le seul cast qui marche sans Warning. Tous les autres (les C++) sifflent a cause de restrict.

On exprime requestedMemSize en nombre de QCFloat. et on arrondi au superieur pour conserver toujours un bon allignement pour les double precision.

Si on a deja alloue un bloc de memoire temporaire, on s en sert.

Prudence, il faut annuler ce pointeur pour ne pas subir de delete malvenu derriere le giveBack.

on cree le gestionnaire d erreur qui va envoyer le message d erreur.

Definition at line 131 of file QCMemory.cpp.

References blockTmpMem, curTmpMem, endOfBlock, QCErrorManager::ERROR, freeMemPtr, QCMemory::QCStackCell::memSize, stackPtr, stackPtrIndex, QCErrorManager::TMP_MEMORY, and QCErrorManager::writeMsg().

Here is the call graph for this function:

template<class TP>
bool QCMemory::giveBackTmpMem TP *__restrict__ &  tmpMemPtr  ) 
 

Free the temporary memory. Be careful, the memory manager is implemented like a stack. So that its working pattern is First In - Last Out.

void QCMemory::printQCMemory void   ) 
 

Print the variables of the class

Definition at line 365 of file QCMemory.cpp.

References blockSize, blockTmpMem, curTmpMem, endOfBlock, freeMemPtr, maxTmpMem, QCMemory::QCStackCell::memPtr, QCMemory::QCStackCell::memSize, stackPtr, stackPtrIndex, and stackPtrMaxIndex.

Referenced by setUsedMemoryMax().

void QCMemory::printUsedMemoryMax void   ) 
 

Posting of the maximum amount of used RAM.

Definition at line 355 of file QCMemory.cpp.

bool QCMemory::setUsedMemoryMax const int  size  ) 
 

set the maximum amount of occupied RAM.

Definition at line 411 of file QCMemory.cpp.

References maxTmpMem, printQCMemory(), and updateBlockTmpMem().

Here is the call graph for this function:

template<class TP>
template char * QCMemory::takeTmpMem< char > const int &  nb  ) 
 

Request for temporary memory. Be careful, the memory manager is implemented like a stack. So that its working pattern is First In - Last Out.

Definition at line 49 of file QCMemory.cpp.

References blockTmpMem, curTmpMem, endOfBlock, freeMemPtr, maxTmpMem, QCMemory::QCStackCell::memPtr, QCMemory::QCStackCell::memSize, stackPtr, stackPtrIndex, and stackPtrMaxIndex.

bool QCMemory::updateBlockTmpMem void   ) 
 

Update the size of the memory block used to satisfy the request of temporary memory.

Definition at line 213 of file QCMemory.cpp.

References QCErrorManager::BAD_ALLOC, blockSize, blockTmpMem, curTmpMem, endOfBlock, QCErrorManager::ERROR, freeMemPtr, maxTmpMem, and QCErrorManager::writeMsg().

Referenced by QCModelMatrices::prepareIterations(), and setUsedMemoryMax().

Here is the call graph for this function:


Member Data Documentation

int QCMemory::blockSize [private]
 

Size of the block of temporary space expressed in number of QCFloat

Definition at line 165 of file QCMemory.hpp.

Referenced by disallocateBlockTmpMem(), printQCMemory(), and updateBlockTmpMem().

QCFloat* QCMemory::blockTmpMem [private]
 

Block of temporary memory, it's expressed in QCFloat to avoid problems of memory alignment

Definition at line 149 of file QCMemory.hpp.

Referenced by disallocateBlockTmpMem(), giveBackTmpMem(), printQCMemory(), takeTmpMem(), and updateBlockTmpMem().

int QCMemory::curTmpMem [private]
 

Size of temporary memory used expressed in number of QCFloat

Definition at line 137 of file QCMemory.hpp.

Referenced by giveBackTmpMem(), printQCMemory(), takeTmpMem(), and updateBlockTmpMem().

QCFloat* QCMemory::endOfBlock [private]
 

Pointer towards the end of blockTmpMem

Definition at line 159 of file QCMemory.hpp.

Referenced by giveBackTmpMem(), printQCMemory(), takeTmpMem(), and updateBlockTmpMem().

QCFloat* QCMemory::freeMemPtr [private]
 

Pointer towards the begining of the free zone in blockTmpMem

Definition at line 154 of file QCMemory.hpp.

Referenced by giveBackTmpMem(), printQCMemory(), takeTmpMem(), and updateBlockTmpMem().

int QCMemory::maxTmpMem [private]
 

Maximum size of temporary memory requested expressed in number of QCFloat

Definition at line 143 of file QCMemory.hpp.

Referenced by disallocateBlockTmpMem(), printQCMemory(), setUsedMemoryMax(), takeTmpMem(), and updateBlockTmpMem().

QCStackCell* QCMemory::stackPtr [private]
 

The intern stack of SQCStackCell of the memory manager

Definition at line 170 of file QCMemory.hpp.

Referenced by disallocateBlockTmpMem(), giveBackTmpMem(), printQCMemory(), and takeTmpMem().

int QCMemory::stackPtrIndex [private]
 

Index of the top of the stack

Definition at line 175 of file QCMemory.hpp.

Referenced by giveBackTmpMem(), printQCMemory(), and takeTmpMem().

int QCMemory::stackPtrMaxIndex [private]
 

Maximum index of the top of the stack

Definition at line 180 of file QCMemory.hpp.

Referenced by printQCMemory(), and takeTmpMem().


The documentation for this class was generated from the following files:
Generated on Sat Jan 28 21:07:34 2006 for QC++ by  doxygen 1.4.4