#include <PersistentData.H>
Public Member Functions | |
void | ClearStream () |
delete the assigned file | |
void | ClearCollection () |
unregister all variables so that the collection becomes empty | |
CPersistentDataCollection (const std::string myFilename) | |
constructor needs a filename to provide persistent storage | |
~CPersistentDataCollection () | |
template<typename T> | |
void | RegisterVar (const std::string ID, T &data) |
register a variable to be persistent | |
template<typename T> | |
void | UnregisterVar (const std::string ID) |
unregister a variable to be no more persistent | |
void | Load () |
load the persistent values for the registered variables from file | |
void | Save () |
save the values for the registered variables to file (to make them persistent) | |
Protected Types | |
typedef std::map< std::string, CPersistentDataInterface * > | TCollection |
Protected Attributes | |
const std::string | filename |
TCollection | collection |
This class stores references to variables denoted by an identifier. On Load/Save requests all these registered variables are read/written to a file (persistent storage).
Warning: Use this class with extreme caution!
Definition at line 78 of file PersistentData.H.
typedef std::map<std::string,CPersistentDataInterface*> CPersistentDataCollection::TCollection [protected] |
Definition at line 81 of file PersistentData.H.
CPersistentDataCollection::CPersistentDataCollection | ( | const std::string | myFilename | ) | [inline, explicit] |
constructor needs a filename to provide persistent storage
Definition at line 105 of file PersistentData.H.
CPersistentDataCollection::~CPersistentDataCollection | ( | ) | [inline] |
Definition at line 108 of file PersistentData.H.
void CPersistentDataCollection::ClearStream | ( | ) | [inline] |
delete the assigned file
Definition at line 88 of file PersistentData.H.
Referenced by elliptic_curves::go().
void CPersistentDataCollection::ClearCollection | ( | ) | [inline] |
unregister all variables so that the collection becomes empty
Definition at line 95 of file PersistentData.H.
void CPersistentDataCollection::RegisterVar | ( | const std::string | ID, | |
T & | data | |||
) | [inline] |
register a variable to be persistent
Definition at line 111 of file PersistentData.H.
References exit().
Referenced by elliptic_curves::go().
void CPersistentDataCollection::UnregisterVar | ( | const std::string | ID | ) | [inline] |
unregister a variable to be no more persistent
Definition at line 122 of file PersistentData.H.
References exit().
void CPersistentDataCollection::Load | ( | ) | [inline] |
load the persistent values for the registered variables from file
Definition at line 137 of file PersistentData.H.
References cout, endl(), exit(), isspace(), and MARK.
Referenced by elliptic_curves::go().
void CPersistentDataCollection::Save | ( | ) | [inline] |
save the values for the registered variables to file (to make them persistent)
Definition at line 170 of file PersistentData.H.
References std::basic_ios< _CharT, _Traits >::out, and std::basic_ios< _CharT, _Traits >::trunc.
Referenced by elliptic_curves::go().
const std::string CPersistentDataCollection::filename [protected] |
Definition at line 82 of file PersistentData.H.
TCollection CPersistentDataCollection::collection [protected] |
Definition at line 83 of file PersistentData.H.