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

#include <soar_module.h>

Inherited by epmem_param_container, rl_param_container, smem_param_container, and wma_param_container.

Public Member Functions

void for_each (accumulator< T * > &f)
T * get (const char *name)
 object_container (agent *new_agent)
virtual ~object_container ()

Protected Member Functions

void add (T *new_object)

Protected Attributes

agentmy_agent
std::map< std::string, T * > * objects

Detailed Description

template<class T>
class soar_module::object_container< T >

Definition at line 188 of file soar_module.h.

Constructor & Destructor Documentation

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

Definition at line 201 of file soar_module.h.

: my_agent( new_agent ), objects( new std::map<std::string, T *> ) {}
template<class T>
virtual soar_module::object_container< T >::~object_container ( )
inlinevirtual

Definition at line 203 of file soar_module.h.

{
typename std::map<std::string, T *>::iterator p;
for ( p=objects->begin(); p!=objects->end(); p++ )
delete p->second;
delete objects;
}

Member Function Documentation

template<class T>
void soar_module::object_container< T >::add ( T *  new_object)
inlineprotected

Definition at line 194 of file soar_module.h.

Referenced by epmem_param_container::epmem_param_container(), rl_param_container::rl_param_container(), smem_param_container::smem_param_container(), and wma_param_container::wma_param_container().

{
std::string temp_str( new_object->get_name() );
(*objects)[ temp_str ] = new_object;
}
template<class T>
void soar_module::object_container< T >::for_each ( accumulator< T * > &  f)
inline

Definition at line 226 of file soar_module.h.

{
typename std::map<std::string, T *>::iterator p;
for ( p=objects->begin(); p!=objects->end(); p++ )
{
f( p->second );
}
}
template<class T>
T* soar_module::object_container< T >::get ( const char *  name)
inline

Definition at line 215 of file soar_module.h.

{
std::string temp_str( name );
typename std::map<std::string, T *>::iterator p = objects->find( temp_str );
if ( p == objects->end() )
return NULL;
else
return p->second;
}

Field Documentation

template<class T>
agent* soar_module::object_container< T >::my_agent
protected
template<class T>
std::map<std::string, T *>* soar_module::object_container< T >::objects
protected

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