ALBA
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
albaStorable Class Referenceabstract

#include <albaStorable.h>

Inheritance diagram for albaStorable:
Inheritance graph
[legend]

Public Member Functions

 albaStorable ()
 
int Store (albaStorageElement *element)
 
int Restore (albaStorageElement *element)
 
albaObjectCastToObject ()
 
bool IsStorable ()
 

Static Public Member Functions

static albaStorableSafeCastToObject (albaObject *o)
 

Protected Member Functions

virtual int InternalStore (albaStorageElement *node)=0
 
virtual int InternalRestore (albaStorageElement *node)=0
 

Protected Attributes

bool m_Storable
 

Detailed Description

albaStorable is an interface for serializable objects.

The idea behind this class is to act as in interface to be inherited to become a serializable object. This is a abstract interface, since Store and Restore are not defined and should be implemented. When storing an element must be provided and the store will attach all necessary attributes, data and subnodes to that point. When restoring a correct element to start restoring from must be provided: the given node must have been serialized with the the corresponding store function. Beware, Restore() does not perform a search for the right subnode to be restore, but simply try to restore the given element into itself (the "this" object). On the other end, for subnodes to be restored, the restore implementation will probably implement a search mechanism. This happens for the specialized RestoreXX() functions of the albaStorageElement class, which search for the subnode of with the right name.

Definition at line 40 of file albaStorable.h.

Constructor & Destructor Documentation

◆ albaStorable()

albaStorable::albaStorable ( )
inline

Definition at line 43 of file albaStorable.h.

Member Function Documentation

◆ Store()

int albaStorable::Store ( albaStorageElement element)

Storing this object as part of an XML document.

The element node must be passed as argument, which can eventually be the XML document root. The store function will append all the necessary data and attributes and new XML nodes as children of this node.

◆ Restore()

int albaStorable::Restore ( albaStorageElement element)

Restore this object from an XML document.

The XML element from where starting the restoring must be passed as argument. Notice when restoring an element corresponding to this kind of object must be passed: restore is not going to search for a subnode of the right type. This means the calling restore loop should have identified the node passed as argument as of type to be restored by this object.

◆ CastToObject()

albaObject * albaStorable::CastToObject ( )

safe cast to albaObject, to be used with double inheritance from albaObject and albaStorable

◆ SafeCastToObject()

static albaStorable * albaStorable::SafeCastToObject ( albaObject o)
static

convenience function for dynamic casting

◆ IsStorable()

bool albaStorable::IsStorable ( )
inline

return true if the object should be stored

Definition at line 64 of file albaStorable.h.

◆ InternalStore()

virtual int albaStorable::InternalStore ( albaStorageElement node)
protectedpure virtual

◆ InternalRestore()

virtual int albaStorable::InternalRestore ( albaStorageElement node)
protectedpure virtual

Member Data Documentation

◆ m_Storable

bool albaStorable::m_Storable
protected

if this flag is set to false the object does not store itself

Definition at line 76 of file albaStorable.h.


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