eoState(3)

NAME
eoState - eoState can be used to register derivants of eoPersistent.

SYNOPSIS

#include <eoState.h>

Inherits eoFunctorStore.

  Public Member Functions
void registerObject (eoPersistent &registrant)
Object registration function, note that it does not take ownership!
template<class T> T & takeOwnership (const T &persistent)
Copies the object (MUST be derived from eoPersistent) and returns a reference to the owned object.
std::string getCommentString (void) const
void load (const std::string &_filename)
Reads the file specified.
void load (std::istream &is)
Reads the file specified.
void save (const std::string &_filename) const
Saves the state in file specified.
void save (std::ostream &os) const
Saves the state in file specified.

  Private Types
typedef std::map< std::string, eoPersistent * > ObjectMap

  Private Member Functions
std::string createObjectName (eoObject *obj)
eoState (const eoState &)
eoState & operator= (const eoState &)

  Private Attributes
ObjectMap objectMap
std::vector< ObjectMap::iterator > creationOrder
std::vector< eoPersistent * > ownedObjects

Detailed Description

eoState can be used to register derivants of eoPersistent. It will then in turn implement the persistence framework through members load and save, that will call readFrom and printOn for the registrated objects.

It is derived from eoFunctorStore, so that it also serves as a place where all those nifty eo functors can be stored. This is useful in the case you want to use one of the make_* functions. These functions generally take as their last argument an eoFunctorStore (or a state) which is used to hold all dynamically generated data. Note however, that unlike with eoPersistent derived classes, eoFunctorBase derived classes are not saved or loaded. To govern the creation of functors, command-line parameters (which can be stored) are needed.

Definition at line 54 of file eoState.h.

Member Function Documentation

  template<class T> T& eoState::takeOwnership (const T & persistent) [inline]

Copies the object (MUST be derived from eoPersistent) and returns a reference to the owned object.

Note: it does not register the object, this must be done afterwards!

Definition at line 73 of file eoState.h.

  void eoState::load (const std::string & _filename)

Reads the file specified.

Parameters:
    _filename the name of the file to load from

Definition at line 74 of file eoState.cpp.

  void eoState::load (std::istream & is)

Reads the file specified.

Parameters:
    is the stream to load from

Definition at line 87 of file eoState.cpp.

References eoPersistent::readFrom().

  void eoState::save (const std::string & _filename) const

Saves the state in file specified.

Parameters:
    _filename the name of the file to save into

Definition at line 148 of file eoState.cpp.

Referenced by eoTimedStateSaver::operator()().

  void eoState::save (std::ostream & os) const

Saves the state in file specified.

Parameters:
    os the stream to save into

Definition at line 161 of file eoState.cpp.

References eoPrintable::printOn().

Author

Generated automatically by Doxygen for EO from the source code.