EvolvingObjects
|
eoState can be used to register derivants of eoPersistent. More...
#include <eoState.h>
Classes | |
struct | loading_error |
Loading error thrown when nothing seems to work. More... | |
Public Member Functions | |
eoState (std::string name="") | |
void | formatLatex (std::string name) |
void | formatJSON (std::string name) |
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. | |
Protected Member Functions | |
void | saveSection (std::ostream &os, std::vector< ObjectMap::iterator >::const_iterator it) const |
Private Types | |
typedef std::map< std::string, eoPersistent * > | ObjectMap |
Private Member Functions | |
std::string | createObjectName (eoObject *obj) |
eoState (const eoState &) | |
eoState & | operator= (const eoState &) |
void | removeComment (std::string &str, std::string comment) |
@} | |
bool | is_section (const std::string &str, std::string &name) |
Private Attributes | |
ObjectMap | objectMap |
std::vector< ObjectMap::iterator > | creationOrder |
std::vector< eoPersistent * > | ownedObjects |
std::string | _tag_state_so |
std::string | _tag_state_name |
std::string | _tag_state_sc |
std::string | _tag_section_so |
std::string | _tag_section_sc |
std::string | _tag_content_s |
std::string | _tag_content_e |
std::string | _tag_section_sep |
std::string | _tag_section_e |
std::string | _tag_state_e |
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.
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 115 of file eoState.h.
Referenced by do_make_pop().
void eoState::load | ( | const std::string & | _filename | ) |
Reads the file specified.
_filename | the name of the file to load from |
Referenced by do_make_pop().
void eoState::load | ( | std::istream & | is | ) |
Reads the file specified.
is | the stream to load from |
Definition at line 90 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 |
void eoState::save | ( | std::ostream & | os | ) | const |
Saves the state in file specified.
os | the stream to save into |
Definition at line 186 of file eoState.cpp.