#include <glv_model.h>
Public Member Functions | |
const std::string & | name () const |
Get identifier name. | |
const Snapshots & | snapshots () const |
Get snapshots. | |
int | snapshotsToFile (const std::string &path) const |
Save all snapshots to a file. Returns number of characters written. | |
int | snapshotsToString (std::string &dst) const |
Convert all snapshots to a table string. Returns number of characters written. | |
int | snapshotFromString (const std::string &src) |
Set snapshot from a table string. If the snapshot does not exist, a new one will be created. | |
int | snapshotsFromFile (const std::string &path, bool addtoExisting=true) |
Load snapshots from a file. Returns number of characters read. | |
int | snapshotsFromString (const std::string &src) |
Set snapshots from a table string. If a snapshot does not exist, a new one will be created. | |
void | add (const std::string &name, Model &v) |
Add new name-value pair. | |
void | name (const std::string &v) |
Set identifier name. | |
void | remove (const std::string &name) |
Remove model data with given name. | |
void | saveSnapshot (const std::string &name) |
Save current model state as a snapshot with given name. | |
void | loadSnapshot (const std::string &name) |
Load snapshot with given name into current model state. | |
Protected Member Functions | |
bool | stateToToken (std::string &dst, const std::string &modelName) const |
Convert current model state to string. | |
int | stateFromToken (const std::string &src) |
Convert string to model state. |
When a snapshot is loaded, only data having an identifier having an identical identifier of an attached model is loaded. If an attached model variable exists, but does not have a corresponding variable in a snapshot, then the model data will not be modified when the snapshot is loaded.
void glv::ModelManager::add | ( | const std::string & | name, | |
Model & | v | |||
) |
Add new name-value pair.
The added Data should have the same lifecycle as 'this'. This is because pointers are stored internally.
void glv::ModelManager::saveSnapshot | ( | const std::string & | name | ) |
Save current model state as a snapshot with given name.
If a snapshot with the given name exists, then it will be overwritten.