#include <G4Allocator.hh>
Public Types | |
typedef Type | value_type |
typedef size_t | size_type |
typedef ptrdiff_t | difference_type |
typedef Type * | pointer |
typedef const Type * | const_pointer |
typedef Type & | reference |
typedef const Type & | const_reference |
Public Member Functions | |
G4Allocator () throw () | |
~G4Allocator () throw () | |
Type * | MallocSingle () |
void | FreeSingle (Type *anElement) |
void | ResetStorage () |
size_t | GetAllocatedSize () const |
int | GetNoPages () const |
size_t | GetPageSize () const |
void | IncreasePageSize (unsigned int sz) |
template<class U> | |
G4Allocator (const G4Allocator< U > &right) throw () | |
pointer | address (reference r) const |
const_pointer | address (const_reference r) const |
pointer | allocate (size_type n, void *=0) |
void | deallocate (pointer p, size_type n) |
void | construct (pointer p, const Type &val) |
void | destroy (pointer p) |
size_type | max_size () const throw () |
Data Fields | |
G4AllocatorPool | mem |
Data Structures | |
struct | rebind |
Definition at line 53 of file G4Allocator.hh.
typedef const Type* G4Allocator< Type >::const_pointer |
Definition at line 93 of file G4Allocator.hh.
typedef const Type& G4Allocator< Type >::const_reference |
Definition at line 95 of file G4Allocator.hh.
typedef ptrdiff_t G4Allocator< Type >::difference_type |
Definition at line 91 of file G4Allocator.hh.
typedef Type* G4Allocator< Type >::pointer |
Definition at line 92 of file G4Allocator.hh.
typedef Type& G4Allocator< Type >::reference |
Definition at line 94 of file G4Allocator.hh.
typedef size_t G4Allocator< Type >::size_type |
Definition at line 90 of file G4Allocator.hh.
typedef Type G4Allocator< Type >::value_type |
Definition at line 89 of file G4Allocator.hh.
G4Allocator< Type >::G4Allocator | ( | ) | throw () |
G4Allocator< Type >::~G4Allocator | ( | ) | throw () |
G4Allocator< Type >::G4Allocator | ( | const G4Allocator< U > & | right | ) | throw () [inline] |
const_pointer G4Allocator< Type >::address | ( | const_reference | r | ) | const [inline] |
pointer G4Allocator< Type >::address | ( | reference | r | ) | const [inline] |
pointer G4Allocator< Type >::allocate | ( | size_type | n, | |
void * | = 0 | |||
) | [inline] |
Definition at line 105 of file G4Allocator.hh.
References G4Allocator< Type >::MallocSingle().
00106 { 00107 // Allocates space for n elements of type Type, but does not initialise 00108 // 00109 Type* mem_alloc = 0; 00110 if (n == 1) 00111 mem_alloc = MallocSingle(); 00112 else 00113 mem_alloc = static_cast<Type*>(::operator new(n*sizeof(Type))); 00114 return mem_alloc; 00115 }
void G4Allocator< Type >::construct | ( | pointer | p, | |
const Type & | val | |||
) | [inline] |
void G4Allocator< Type >::deallocate | ( | pointer | p, | |
size_type | n | |||
) | [inline] |
Definition at line 116 of file G4Allocator.hh.
References G4Allocator< Type >::FreeSingle().
00117 { 00118 // Deallocates n elements of type Type, but doesn't destroy 00119 // 00120 if (n == 1) 00121 FreeSingle(p); 00122 else 00123 ::operator delete((void*)p); 00124 return; 00125 }
void G4Allocator< Type >::destroy | ( | pointer | p | ) | [inline] |
void G4Allocator< Type >::FreeSingle | ( | Type * | anElement | ) | [inline] |
Definition at line 189 of file G4Allocator.hh.
References G4AllocatorPool::Free(), and G4Allocator< Type >::mem.
Referenced by G4Allocator< Type >::deallocate().
size_t G4Allocator< Type >::GetAllocatedSize | ( | ) | const [inline] |
Definition at line 213 of file G4Allocator.hh.
References G4Allocator< Type >::mem, and G4AllocatorPool::Size().
int G4Allocator< Type >::GetNoPages | ( | ) | const [inline] |
Definition at line 223 of file G4Allocator.hh.
References G4AllocatorPool::GetNoPages(), and G4Allocator< Type >::mem.
00224 { 00225 return mem.GetNoPages(); 00226 }
size_t G4Allocator< Type >::GetPageSize | ( | ) | const [inline] |
Definition at line 233 of file G4Allocator.hh.
References G4AllocatorPool::GetPageSize(), and G4Allocator< Type >::mem.
00234 { 00235 return mem.GetPageSize(); 00236 }
void G4Allocator< Type >::IncreasePageSize | ( | unsigned int | sz | ) | [inline] |
Definition at line 243 of file G4Allocator.hh.
References G4AllocatorPool::GrowPageSize(), G4Allocator< Type >::mem, and G4Allocator< Type >::ResetStorage().
00244 { 00245 ResetStorage(); 00246 mem.GrowPageSize(sz); 00247 }
Type * G4Allocator< Type >::MallocSingle | ( | ) | [inline] |
Definition at line 179 of file G4Allocator.hh.
References G4AllocatorPool::Alloc(), and G4Allocator< Type >::mem.
Referenced by G4Allocator< Type >::allocate().
size_type G4Allocator< Type >::max_size | ( | ) | const throw () [inline] |
Definition at line 132 of file G4Allocator.hh.
00133 { 00134 // Returns the maximum number of elements that can be allocated 00135 // 00136 return 2147483647/sizeof(Type); 00137 }
void G4Allocator< Type >::ResetStorage | ( | ) | [inline] |
Definition at line 200 of file G4Allocator.hh.
References G4Allocator< Type >::mem, and G4AllocatorPool::Reset().
Referenced by G4Allocator< Type >::IncreasePageSize().
00201 { 00202 // Clear all allocated storage and return it to the free store 00203 // 00204 mem.Reset(); 00205 return; 00206 }
G4AllocatorPool G4Allocator< Type >::mem |
Definition at line 143 of file G4Allocator.hh.
Referenced by G4Allocator< Type >::FreeSingle(), G4Allocator< Type >::GetAllocatedSize(), G4Allocator< Type >::GetNoPages(), G4Allocator< Type >::GetPageSize(), G4Allocator< Type >::IncreasePageSize(), G4Allocator< Type >::MallocSingle(), and G4Allocator< Type >::ResetStorage().