Public Types | Public Member Functions | Protected Member Functions | List of all members
ifile::CAutoPersistenceComp Class Reference

The component for automatic object persistence. More...

#include <CAutoPersistenceComp.h>

Inheritance diagram for ifile::CAutoPersistenceComp:
ilog::TLoggerCompWrap< Base > imod::CMultiModelDispatcherBase ilog::CLoggerBase istd::IPolymorphic ilog::ILoggable istd::ILogger istd::IPolymorphic istd::IPolymorphic

Public Types

enum  ModelIds { MI_OBJECT, MI_FILEPATH, MI_RUNTIME_STATUS }
 
typedef ilog::CLoggerComponentBase BaseClass
 
typedef
imod::CMultiModelDispatcherBase 
BaseClass2
 
- Public Types inherited from ilog::TLoggerCompWrap< Base >
typedef Base BaseClass
 
typedef ilog::CLoggerBase BaseClass2
 

Public Member Functions

 CAutoPersistenceComp ()
 Default constructor. More...
 
- Public Member Functions inherited from ilog::CLoggerBase
 CLoggerBase ()
 
virtual void SetLogPtr (ilog::IMessageConsumer *logPtr)
 Install log. More...
 
virtual ilog::IMessageConsumerGetLogPtr () const
 Get log. More...
 
virtual void SetTracingEnabled (bool trace)
 Enable/disable tracing. More...
 
virtual bool IsTracingEnabled () const
 Returns true if tracing enabled. More...
 
- Public Member Functions inherited from istd::IPolymorphic
virtual ~IPolymorphic ()
 

Protected Member Functions

void SaveObjectSnapshot ()
 Store object copy in a separate thread. More...
 
virtual bool LoadObject (const QString &filePath)
 Load working object data from some file. More...
 
virtual bool StoreObject (const istd::IChangeable &object)
 Store some object data to working file. More...
 
virtual void OnComponentCreated ()
 
virtual void OnComponentDestroyed ()
 
virtual void OnModelChanged (int modelId, const istd::IChangeable::ChangeSet &changeSet)
 
- Protected Member Functions inherited from ilog::TLoggerCompWrap< Base >
bool IsVerboseEnabled () const
 Check if verbose messages are enabled. More...
 
void SendVerboseMessage (const QString &message, const QString &messageSource=QString()) const
 Send verbose message. More...
 
virtual void DecorateMessage (istd::IInformationProvider::InformationCategory category, int id, int flags, QString &message, QString &messageSource) const
 Decorate message parts before outputting. More...
 
- Protected Member Functions inherited from ilog::CLoggerBase
bool SendInfoMessage (int id, const QString &message, const QString &messageSource=QString(), int flags=0) const
 Send info message to log. More...
 
bool SendWarningMessage (int id, const QString &message, const QString &messageSource=QString(), int flags=0) const
 Send warning message to log. More...
 
bool SendErrorMessage (int id, const QString &message, const QString &messageSource=QString(), int flags=0) const
 Send error message to log. More...
 
bool SendCriticalMessage (int id, const QString &message, const QString &messageSource=QString(), int flags=0) const
 Send critical message to log. More...
 
bool SendInfoMessageOnce (int id, const QString &message, const QString &messageSource=QString(), int flags=0) const
 Send once info message to log. More...
 
bool SendWarningMessageOnce (int id, const QString &message, const QString &messageSource=QString(), int flags=0) const
 Send once warning message to log. More...
 
bool SendErrorMessageOnce (int id, const QString &message, const QString &messageSource=QString(), int flags=0) const
 Send once error message to log. More...
 
bool SendCriticalMessageOnce (int id, const QString &message, const QString &messageSource=QString(), int flags=0) const
 Send once critical message to log. More...
 
bool SendUserMessage (const istd::IInformationProvider *messagePtr) const
 Send message with user object. More...
 
bool AllowMessageOnceAgain (int id)
 Reset message lock. More...
 
virtual bool IsLogConsumed (const istd::IInformationProvider::InformationCategory *categoryPtr=NULL, const int *flagsPtr=NULL) const
 Check if any log message is consumed. More...
 
virtual bool SendLogMessage (istd::IInformationProvider::InformationCategory category, int id, const QString &message, const QString &messageSource, int flags=0) const
 Send any message to log. More...
 
bool RegisterModel (IModel *modelPtr, int modelId=0, const istd::IChangeable::ChangeSet &relevantFlags=istd::IChangeable::GetAllChanges())
 Register the data model to be observed. More...
 
void UnregisterModel (int modelId=0)
 Unregister the data model object. More...
 
void UnregisterAllModels ()
 Unregister all observed data objects. More...
 
template<class Object >
Object * GetObjectAt (int modelId) const
 Get concrete object instance of the obsered model. More...
 

Additional Inherited Members

- Protected Attributes inherited from ilog::CLoggerBase
QSet< int > m_onceMessageIds
 

Detailed Description

The component for automatic object persistence.

With the help of this component data objects can be backed up at specific time points and restored. The data object that should be restored or backed up, will be connected via component reference. The backup or restoring of data is done according to the component configuration, that is given by the component's attributes. Enable RestoreOnBegin attribute if you want to restore the object from the file during component initialization. Enable StoreOnEnd attribute if you want to save the object to the file during component de-initialization. Enable StoreOnChange attribute if you want to save the object to the file each time if the object data was changed. Also you can specify some time interval for permanently data storing. If this parameter is set, then the object will be stored to the file in the given time interval, but only if the object data was changed.

Note
If the time interval for the object storing is set, the StoreOnChange attribute will be ignored.
Please note, that this component doesn't provide any public interfaces. The data object will be attached to the internal observer during the initialization phase of the component. To enforce the instantiation of this component, you should activate 'Automatically create instance' flag in the Compositor.

Definition at line 44 of file CAutoPersistenceComp.h.

Member Typedef Documentation

Definition at line 52 of file CAutoPersistenceComp.h.

Definition at line 53 of file CAutoPersistenceComp.h.

Member Enumeration Documentation

Enumerator
MI_OBJECT 

Object was changed.

MI_FILEPATH 

File path was changed.

MI_RUNTIME_STATUS 

Runtime status was changed.

Definition at line 55 of file CAutoPersistenceComp.h.

Constructor & Destructor Documentation

ifile::CAutoPersistenceComp::CAutoPersistenceComp ( )

Default constructor.

Member Function Documentation

virtual bool ifile::CAutoPersistenceComp::LoadObject ( const QString &  filePath)
protectedvirtual

Load working object data from some file.

virtual void ifile::CAutoPersistenceComp::OnComponentCreated ( )
protectedvirtual

Reimplemented from ilog::TLoggerCompWrap< Base >.

virtual void ifile::CAutoPersistenceComp::OnComponentDestroyed ( )
protectedvirtual

Reimplemented from ilog::TLoggerCompWrap< Base >.

virtual void ifile::CAutoPersistenceComp::OnModelChanged ( int  modelId,
const istd::IChangeable::ChangeSet changeSet 
)
protectedvirtual
void ifile::CAutoPersistenceComp::SaveObjectSnapshot ( )
protected

Store object copy in a separate thread.

virtual bool ifile::CAutoPersistenceComp::StoreObject ( const istd::IChangeable object)
protectedvirtual

Store some object data to working file.


The documentation for this class was generated from the following file:

© 2007-2017 Witold Gantzke and Kirill Lepskiy