This is the documentation for Enlighten.
class Geo GeoFixedPoolAllocator
template<typename TStorage>
class Geo::GeoFixedPoolAllocator
A std::allocator that passes memory requests through to a single underlying GeoAllocationPage.
If you know how many nodes your list/map will use, you can create one of these to improve memory use.
Please note that there are specialized versions of GeoList (GeoFixedPoolList) and GeoMap (GeoFixedPoolMap) that use GeoFixedPoolAllocator per default.
// Setup typedef for the list type. typedef GeoFixedPoolList<int>::Type TPoolList; // Allocate memory for the fixed pool list. // Make sure to use max_allocation_size since the internal data structure is larger than the payload data. // The +1 is needed for the head of the list, where the same is required for the root of a map. GeoAllocationPage pool; pool.Create(TPoolList::max_allocation_size, 1000 + 1); // Setup allocator using the already allocated memory. GeoFixedPoolAllocator<TPoolList::value_type> allocator(&pool); { TPoolList list(allocator); for(s32 i = 0; i < 1000; ++i) { list.insert(list.end(), 2); } GEO_ASSERT(pool.m_InsertionPoint == pool.kSentinel); // pool is full } // allow list to fall out of scope GEO_ASSERT(pool.m_InsertionPoint != pool.kSentinel); // pool is empty (or at least, not full)
Typedefs
Name | Description |
---|---|
const TStorage * const_pointer | All functions and typedefs match those required by the C++0x standard. |
const TStorage & const_reference | All functions and typedefs match those required by the C++0x standard. |
ptrdiff_t difference_type | All functions and typedefs match those required by the C++0x standard. |
TStorage * pointer | All functions and typedefs match those required by the C++0x standard. |
TStorage & reference | All functions and typedefs match those required by the C++0x standard. |
GeoAllocationPage::TIndexer size_type | All functions and typedefs match those required by the C++0x standard. |
TStorage value_type | All functions and typedefs match those required by the C++0x standard. |
Friends
Name | Description |
---|---|
friend class GeoFixedPoolAllocator | All functions and typedefs match those required by the C++0x standard. |
Functions
Name | Description |
---|---|
address(reference) | All functions and typedefs match those required by the C++0x standard. |
address(const_reference) | All functions and typedefs match those required by the C++0x standard. |
allocate(size_type, GeoFixedPoolAllocator< void >::const_pointer) | All functions and typedefs match those required by the C++0x standard. |
construct(pointer, const_reference) | All functions and typedefs match those required by the C++0x standard. |
deallocate(pointer, size_type) | All functions and typedefs match those required by the C++0x standard. |
destroy(pointer) | All functions and typedefs match those required by the C++0x standard. |
GeoFixedPoolAllocator(GeoAllocationPage *) | All functions and typedefs match those required by the C++0x standard. |
GeoFixedPoolAllocator(const GeoFixedPoolAllocator< TOther > &) | All functions and typedefs match those required by the C++0x standard. |
max_size() | All functions and typedefs match those required by the C++0x standard. |
pointer Geo::GeoFixedPoolAllocator< TStorage >::address
public: pointer address
(
  reference x
) const
All functions and typedefs match those required by the C++0x standard.
const_pointer Geo::GeoFixedPoolAllocator< TStorage >::address
public: const_pointer address
(
  const_reference x
) const
All functions and typedefs match those required by the C++0x standard.
pointer Geo::GeoFixedPoolAllocator< TStorage >::allocate
public: pointer allocate
(
  size_type n,
  GeoFixedPoolAllocator< void >::const_pointer hint
)
All functions and typedefs match those required by the C++0x standard.
void Geo::GeoFixedPoolAllocator< TStorage >::construct
public: void construct
(
  pointer p,
  const_reference val
)
All functions and typedefs match those required by the C++0x standard.
void Geo::GeoFixedPoolAllocator< TStorage >::deallocate
public: void deallocate
(
  pointer p,
  size_type n
)
All functions and typedefs match those required by the C++0x standard.
void Geo::GeoFixedPoolAllocator< TStorage >::destroy
public: void destroy
(
  pointer p
)
All functions and typedefs match those required by the C++0x standard.
Geo::GeoFixedPoolAllocator< TStorage >::GeoFixedPoolAllocator
public: GeoFixedPoolAllocator
(
  GeoAllocationPage * pPool
)
All functions and typedefs match those required by the C++0x standard.
Geo::GeoFixedPoolAllocator< TStorage >::GeoFixedPoolAllocator
public: GeoFixedPoolAllocator
(
  const GeoFixedPoolAllocator< TOther > & rhs
)
All functions and typedefs match those required by the C++0x standard.
size_type Geo::GeoFixedPoolAllocator< TStorage >::max_size
public: size_type max_size() const
All functions and typedefs match those required by the C++0x standard.