SCL  1.0
Standard Control Library : Control, dynamics, physics, and simulation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Macros Groups Pages
Public Member Functions | Protected Attributes | List of all members
sutil::CObjectHistory< Idx, StoreObjectsAs > Class Template Reference

#include <CObjectHistory.hpp>

Collaboration diagram for sutil::CObjectHistory< Idx, StoreObjectsAs >:
Collaboration graph
[legend]

Public Member Functions

bool saveObject (const Idx &arg_idx, const StoreObjectsAs &arg_obj)
 
const CMappedList< double,
StoreObjectsAs > * 
getObjectTimeSeries (const Idx &arg_idx)
 
const StoreObjectsAs * getObject (const Idx &arg_idx, double arg_time=-1.0)
 
bool removeObjectTimeSeries (const Idx &arg_idx)
 
bool removeObject (const Idx &arg_idx, double arg_time=-1)
 
 CObjectHistory ()
 
 ~CObjectHistory ()
 

Protected Attributes

CMappedList< Idx, CMappedList
< double, StoreObjectsAs > > 
data_
 

Detailed Description

template<typename Idx, typename StoreObjectsAs>
class sutil::CObjectHistory< Idx, StoreObjectsAs >

Time stamps an object, copies it and saves it. The object may be restored at any future point of time.

NOTE: Since this requires a memory copy, it will be slow in general.

Templpate parameters:

  1. Idx : The class will create a map and will index all stored objects by an Idx type key. Each object's key must be unique.
  2. StoreObjectsAs : The class requires a you to convert all objects into a given StoreObjectsAs type. The StoreObjectsAs type must have a public constructor, a copy constructor and a destructor that correctly deallocates its memory. Ie. An Idx will work, but a simple typecast to char* won't.

Of course, you must use another class in tandem to convert your objects into something that can be stored here.

Constructor & Destructor Documentation

template<typename Idx , typename StoreObjectsAs >
sutil::CObjectHistory< Idx, StoreObjectsAs >::CObjectHistory ( )
inline

Constructor : Does nothing.

template<typename Idx , typename StoreObjectsAs >
sutil::CObjectHistory< Idx, StoreObjectsAs >::~CObjectHistory ( )
inline

Destructor : Does nothing.

Member Function Documentation

template<typename Idx , typename StoreObjectsAs >
const StoreObjectsAs* sutil::CObjectHistory< Idx, StoreObjectsAs >::getObject ( const Idx &  arg_idx,
double  arg_time = -1.0 
)
inline

Retrieves an object from a point in its stored history

Parameters
arg_timeOptional timestamp argument. Ignore this to get the last saved state.
template<typename Idx , typename StoreObjectsAs >
const CMappedList<double, StoreObjectsAs>* sutil::CObjectHistory< Idx, StoreObjectsAs >::getObjectTimeSeries ( const Idx &  arg_idx)
inline

Retrieves an object's entire stored history

template<typename Idx , typename StoreObjectsAs >
bool sutil::CObjectHistory< Idx, StoreObjectsAs >::removeObject ( const Idx &  arg_idx,
double  arg_time = -1 
)
inline

Pointer deletion requires knowing the type.

Parameters
arg_timeOptional timestamp argument. Ignore this to remove the last saved state.
template<typename Idx , typename StoreObjectsAs >
bool sutil::CObjectHistory< Idx, StoreObjectsAs >::removeObjectTimeSeries ( const Idx &  arg_idx)
inline

Pointer deletion requires knowing the type. The Idx and StoreObjectsAsdestructors should work.

template<typename Idx , typename StoreObjectsAs >
bool sutil::CObjectHistory< Idx, StoreObjectsAs >::saveObject ( const Idx &  arg_idx,
const StoreObjectsAs &  arg_obj 
)
inline

Saves the current state of an object (can be retrieved later)

Member Data Documentation

template<typename Idx , typename StoreObjectsAs >
CMappedList< Idx, CMappedList<double, StoreObjectsAs> > sutil::CObjectHistory< Idx, StoreObjectsAs >::data_
protected

Index all stored objects by an index and timestamp in a two level mapped list.


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