AllocatorLocal< T > Class Template Reference

#include <GlobalDefinitions.h>

Inheritance diagram for AllocatorLocal< T >:

Inheritance graph
[legend]
Collaboration diagram for AllocatorLocal< T >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 AllocatorLocal (T **ptr=NULL, const string &name="", ostream &monStream=cerr)
virtual Allocator< T > * clone (T **ptr, const string &name, ostream &monStream=cerr)
virtual ~AllocatorLocal ()
virtual void allocate (unsigned long size)
virtual void allocateAndZero (unsigned long size)
virtual void load (unsigned long size)
virtual void save ()
virtual void deallocate ()

Detailed Description

template<typename T>
class AllocatorLocal< T >

Definition at line 768 of file GlobalDefinitions.h.


Constructor & Destructor Documentation

template<typename T>
AllocatorLocal< T >::AllocatorLocal ( T **  ptr = NULL,
const string &  name = "",
ostream &  monStream = cerr 
) [inline]

Definition at line 772 of file GlobalDefinitions.h.

00774                                             : 
00775   Allocator<T>(ptr,name,monStream) 
00776   {}

template<typename T>
virtual AllocatorLocal< T >::~AllocatorLocal (  )  [inline, virtual]

Definition at line 784 of file GlobalDefinitions.h.

00785   { 
00786     deallocate(); 
00787   }


Member Function Documentation

template<typename T>
virtual Allocator<T>* AllocatorLocal< T >::clone ( T **  ptr,
const string &  name,
ostream &  monStream = cerr 
) [inline, virtual]

Implements Allocator< T >.

Definition at line 779 of file GlobalDefinitions.h.

00780   {
00781     return new AllocatorLocal<T>(ptr,name,monStream);
00782   }

template<typename T>
virtual void AllocatorLocal< T >::allocate ( unsigned long  size  )  [inline, virtual]

Implements Allocator< T >.

Definition at line 789 of file GlobalDefinitions.h.

Referenced by AllocatorLocal< PositionInDatabase >::allocateAndZero(), and AllocatorLocal< PositionInDatabase >::load().

00790   {
00791     size_=size;
00792     (*ptr_)=new T[size_];
00793     isAllocated_=true;
00794   }

Here is the caller graph for this function:

template<typename T>
virtual void AllocatorLocal< T >::allocateAndZero ( unsigned long  size  )  [inline, virtual]

Implements Allocator< T >.

Definition at line 796 of file GlobalDefinitions.h.

00797   {
00798     const unsigned char zero(0);
00799     allocate(size);
00800     memset( (void*)(*ptr_), zero, size_*sizeof(MyType) );
00801   }

template<typename T>
virtual void AllocatorLocal< T >::load ( unsigned long  size  )  [inline, virtual]

Implements Allocator< T >.

Definition at line 802 of file GlobalDefinitions.h.

00803   {
00804     allocate(size);
00805     loadFromFile( name_, (char*)(*ptr_), size_*sizeof(MyType), monStream_ );
00806   }

template<typename T>
virtual void AllocatorLocal< T >::save (  )  [inline, virtual]

Implements Allocator< T >.

Definition at line 807 of file GlobalDefinitions.h.

00808   {
00809     saveToFile( name_, (char*)(*ptr_), size_*sizeof(MyType), monStream_ );
00810   }

template<typename T>
virtual void AllocatorLocal< T >::deallocate (  )  [inline, virtual]

Implements Allocator< T >.

Definition at line 812 of file GlobalDefinitions.h.

Referenced by AllocatorLocal< PositionInDatabase >::~AllocatorLocal().

00813   {
00814     if (!isAllocated_) return;
00815     delete [] (*ptr_);
00816     isAllocated_=false;
00817   }

Here is the caller graph for this function:


The documentation for this class was generated from the following file:
Generated on Fri Dec 21 13:15:39 2007 for ssaha by  doxygen 1.5.2