Persistence controller for simple variable. More...
Persistence controller for simple variable.
The data synchronization is handle by a SynchronThreadGroup.
RT_ERROR_SYNC_PERSISTENT_NOT_ABLE_OPEN_FILE is only shown through GetLastExceptionMessage()
Public Member Methods | |
SyncPersistenceController () | |
Constructor. More... | |
~SyncPersistenceController () | |
Destructor. More... | |
void | Start (SynchronThreadGroup &group, PCChar8 persistenceSubFolderName=NULL) |
Start the persistence controller. More... | |
void | RequestTerminate () |
Request the controller for terminate. More... | |
bool | WaitTerminated (TimeSpan timeout=TimeInfinite) |
Wait for the controller to terminate. More... | |
template<class T > | |
void | Register (PCChar8 persistenceName, T &data) |
Register a variable to persiste More... | |
void | Unregister (PCChar8 persistenceName) |
Unregister a variable to persiste More... | |
bool | HasUnsafeData () |
Query if there are unsafe data. More... | |
void | ClearHasUnsafeData () |
Clear the unsafe data flag. More... | |
bool | HasException () |
Query if there are exception that occured in the controller. More... | |
const String & | GetLastExceptionMessage () |
Gets the message exception that occured in the controller. More... | |
void | ClearHasException () |
Clear the exception flag. More... | |
Strings & | GetDiagnostics () |
Gets the diagnostic messages given by the controller when Register variables. More... | |
Constructor.
Destructor.
Wait thread for terminate.
void ClearHasException | ( | ) |
Clear the exception flag.
void ClearHasUnsafeData | ( | ) |
Clear the unsafe data flag.
Strings& GetDiagnostics | ( | ) |
Gets the diagnostic messages given by the controller when Register variables.
const String& GetLastExceptionMessage | ( | ) |
Gets the message exception that occured in the controller.
bool HasException | ( | ) |
Query if there are exception that occured in the controller.
bool HasUnsafeData | ( | ) |
Query if there are unsafe data.
Unsafe data are detected whenever the controller has not been stopped properly once. (Crash or programming fault).
|
inline |
Register a variable to persiste
persistenceName | Variable identifiant. Should be unique in a controller. |
data | the variable. |
void RequestTerminate | ( | ) |
Request the controller for terminate.
void Start | ( | SynchronThreadGroup & | group, |
PCChar8 | persistenceSubFolderName = NULL |
||
) |
Start the persistence controller.
group | [in, out] The SynchronThreadGroup used for the concurrent data access synchronization. |
persistenceSubFolderName | [in] The persistence Sub Folder Name in the GetPersistencePath() directory. |
void Unregister | ( | PCChar8 | persistenceName | ) |
Unregister a variable to persiste
persistenceName | Variable identifiant. |
bool WaitTerminated | ( | TimeSpan | timeout = TimeInfinite | ) |
Wait for the controller to terminate.
timeout | (optional) the time out. Default = TimeInfinite |