Soar Kernel  9.3.2 08-06-12
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Data Structures | Public Types | Public Member Functions | Private Member Functions | Private Attributes
soar_module::soar_memory_pool_allocator< T > Class Template Reference

#include <soar_module.h>

Data Structures

struct  rebind

Public Types

typedef const T * const_pointer
typedef const T & const_reference
typedef ptrdiff_t difference_type
typedef T * pointer
typedef T & reference
typedef size_t size_type
typedef T value_type

Public Member Functions

const_pointer address (const_reference r) const
pointer address (reference r) const
pointer allocate (size_type n, const void *=0)
void construct (pointer p, const_reference val)
void deallocate (void *p, size_type n)
void destroy (pointer p)
agentget_agent () const
size_type max_size () const
 soar_memory_pool_allocator (agent *new_agent)
 soar_memory_pool_allocator (const soar_memory_pool_allocator &obj)
template<class _other >
 soar_memory_pool_allocator (const soar_memory_pool_allocator< _other > &other)

Private Member Functions

 soar_memory_pool_allocator ()

Private Attributes

memory_poolmem_pool
agentmy_agent
size_type size

Detailed Description

template<class T>
class soar_module::soar_memory_pool_allocator< T >

Definition at line 928 of file soar_module.h.

Member Typedef Documentation

template<class T>
typedef const T* soar_module::soar_memory_pool_allocator< T >::const_pointer

Definition at line 936 of file soar_module.h.

template<class T>
typedef const T& soar_module::soar_memory_pool_allocator< T >::const_reference

Definition at line 939 of file soar_module.h.

template<class T>
typedef ptrdiff_t soar_module::soar_memory_pool_allocator< T >::difference_type

Definition at line 933 of file soar_module.h.

template<class T>
typedef T* soar_module::soar_memory_pool_allocator< T >::pointer

Definition at line 935 of file soar_module.h.

template<class T>
typedef T& soar_module::soar_memory_pool_allocator< T >::reference

Definition at line 938 of file soar_module.h.

template<class T>
typedef size_t soar_module::soar_memory_pool_allocator< T >::size_type

Definition at line 932 of file soar_module.h.

template<class T>
typedef T soar_module::soar_memory_pool_allocator< T >::value_type

Definition at line 931 of file soar_module.h.

Constructor & Destructor Documentation

template<class T>
soar_module::soar_memory_pool_allocator< T >::soar_memory_pool_allocator ( agent new_agent)
inline

Definition at line 944 of file soar_module.h.

: my_agent(new_agent), mem_pool(NULL), size(sizeof(value_type))
{
// useful for debugging
// std::string temp_this( typeid( value_type ).name() );
}

Definition at line 950 of file soar_module.h.

: my_agent(obj.get_agent()), mem_pool(NULL), size(sizeof(value_type))
{
// useful for debugging
// std::string temp_this( typeid( value_type ).name() );
}
template<class T>
template<class _other >
soar_module::soar_memory_pool_allocator< T >::soar_memory_pool_allocator ( const soar_memory_pool_allocator< _other > &  other)
inline

Definition at line 957 of file soar_module.h.

: my_agent(other.get_agent()), mem_pool(NULL), size(sizeof(value_type))
{
// useful for debugging
// std::string temp_this( typeid( T ).name() );
// std::string temp_other( typeid( _other ).name() );
}
template<class T>
soar_module::soar_memory_pool_allocator< T >::soar_memory_pool_allocator ( )
inlineprivate

Definition at line 1043 of file soar_module.h.

{}

Member Function Documentation

template<class T>
const_pointer soar_module::soar_memory_pool_allocator< T >::address ( const_reference  r) const
inline

Definition at line 1021 of file soar_module.h.

{
return &r;
}
template<class T>
pointer soar_module::soar_memory_pool_allocator< T >::address ( reference  r) const
inline

Definition at line 1026 of file soar_module.h.

{
return &r;
}
template<class T>
pointer soar_module::soar_memory_pool_allocator< T >::allocate ( size_type  n,
const void *  = 0 
)
inline
template<class T>
void soar_module::soar_memory_pool_allocator< T >::construct ( pointer  p,
const_reference  val 
)
inline

Definition at line 1006 of file soar_module.h.

{
new (p) T( val );
}
template<class T>
void soar_module::soar_memory_pool_allocator< T >::deallocate ( void *  p,
size_type  n 
)
inline

Definition at line 983 of file soar_module.h.

References soar_module::get_memory_pool(), soar_module::soar_memory_pool_allocator< T >::mem_pool, soar_module::soar_memory_pool_allocator< T >::my_agent, and soar_module::soar_memory_pool_allocator< T >::size.

{
assert( n == 1 );
// not sure if this is correct...
// it only comes up if an object uses another object's
// allocator to deallocate memory that it allocated.
// it's quite possible, then, that the sizes would be off
if ( !mem_pool )
{
}
if ( p )
{
free_with_pool( mem_pool, p );
}
}
template<class T>
void soar_module::soar_memory_pool_allocator< T >::destroy ( pointer  p)
inline

Definition at line 1011 of file soar_module.h.

{
p->~T();
}
template<class T>
agent* soar_module::soar_memory_pool_allocator< T >::get_agent ( ) const
inline

Definition at line 942 of file soar_module.h.

References soar_module::soar_memory_pool_allocator< T >::my_agent.

{ return my_agent; }
template<class T>
size_type soar_module::soar_memory_pool_allocator< T >::max_size ( ) const
inline

Definition at line 1016 of file soar_module.h.

{
return static_cast< size_type >( -1 );
}

Field Documentation

template<class T>
memory_pool* soar_module::soar_memory_pool_allocator< T >::mem_pool
private
template<class T>
agent* soar_module::soar_memory_pool_allocator< T >::my_agent
private
template<class T>
size_type soar_module::soar_memory_pool_allocator< T >::size
private

The documentation for this class was generated from the following file: