#include <eoState.h>
Public Member Functions | |
void | registerObject (eoPersistent ®istrant) |
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 |
Classes | |
struct | loading_error |
Loading error thrown when nothing seems to work. More... |
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.
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!
void eoState::load | ( | const std::string & | _filename | ) |
Reads the file specified.
_filename | the name of the file to load from |
void eoState::load | ( | std::istream & | is | ) |
Reads the file specified.
is | the stream to load from |
Definition at line 87 of file eoState.cpp.
void eoState::save | ( | const std::string & | _filename | ) | const |
Saves the state in file specified.
_filename | the name of the file to save into |
Referenced by eoTimedStateSaver::operator()().
void eoState::save | ( | std::ostream & | os | ) | const |
Saves the state in file specified.
os | the stream to save into |
Definition at line 161 of file eoState.cpp.