ALBA
|
#include <albaStorageElement.h>
Public Types | |
typedef std::vector< albaStorageElement * > | ChildrenVector |
Public Member Functions | |
virtual | ~albaStorageElement () |
virtual const char * | GetName ()=0 |
virtual void | SetAttribute (const char *name, const char *value)=0 |
void | SetAttribute (const char *name, const albaID value) |
void | SetAttribute (const char *name, const double value) |
virtual bool | GetAttribute (const char *name, albaString &value)=0 |
bool | GetAttributeAsDouble (const char *name, double &value) |
bool | GetAttributeAsInteger (const char *name, albaID &value) |
albaString | UpgradeAttribute (const char *attribute) |
virtual int | StoreText (const char *name, const char *text)=0 |
virtual int | StoreMatrix (const char *name, const albaMatrix *matrix)=0 |
virtual int | StoreVectorN (const char *name, double *comps, int num)=0 |
virtual int | StoreVectorN (const char *name, int *comps, int num)=0 |
virtual int | StoreVectorN (const char *name, const std::vector< double > &comps, int num)=0 |
virtual int | StoreVectorN (const char *name, const std::vector< int > &comps, int num)=0 |
virtual int | StoreVectorN (const char *name, const std::vector< albaString > &comps, int num, const char *tag)=0 |
int | RestoreMatrix (const char *name, albaMatrix *matrix) |
int | RestoreVectorN (const char *name, double *comps, unsigned int num) |
int | RestoreVectorN (const char *name, int *comps, unsigned int num) |
int | RestoreVectorN (const char *name, std::vector< double > &comps, unsigned int num) |
int | RestoreVectorN (const char *name, std::vector< int > &comps, unsigned int num) |
int | RestoreVectorN (const char *name, std::vector< albaString > &comps, unsigned int num, const char *tag) |
int | RestoreText (const char *name, char *&buffer) |
int | RestoreText (const char *name, albaString &buffer) |
virtual int | RestoreMatrix (albaMatrix *matrix)=0 |
virtual int | RestoreVectorN (double *comps, unsigned int num)=0 |
virtual int | RestoreVectorN (int *comps, unsigned int num)=0 |
virtual int | RestoreVectorN (std::vector< double > &comps, unsigned int num)=0 |
virtual int | RestoreVectorN (std::vector< int > &comps, unsigned int num)=0 |
virtual int | RestoreVectorN (std::vector< albaString > &comps, unsigned int num, const char *tag)=0 |
virtual int | RestoreText (albaString &buffer)=0 |
virtual int | RestoreText (char *&buffer) |
int | StoreDouble (const char *name, const double &value) |
int | RestoreDouble (const char *name, double &value) |
int | RestoreDouble (double &value) |
int | StoreInteger (const char *name, const int &value) |
int | RestoreInteger (const char *name, int &value) |
int | RestoreInteger (int &value) |
int | RestoreObject (const char *name, albaStorable *object) |
albaObject * | RestoreObject (const char *name) |
albaObject * | RestoreObject () |
albaStorageElement * | StoreObject (const char *name, albaObject *object) |
virtual int | StoreObjectVector (const char *name, const std::vector< albaObject * > &vector, const char *items_name="Item") |
virtual int | RestoreObjectVector (const char *name, std::vector< albaObject * > &vector, const char *items_name="Item") |
virtual int | RestoreObjectVector (albaStorageElement *element, std::vector< albaObject * > &vector, const char *items_name="Item") |
albaStorage * | GetStorage () |
albaStorageElement * | GetParent () |
virtual albaStorageElement * | AppendChild (const char *name)=0 |
virtual albaStorageElement * | FindNestedElement (const char *name) |
virtual ChildrenVector & | GetChildren ()=0 |
virtual bool | GetNestedElementsByName (const char *name, std::vector< albaStorageElement * > &list) |
Protected Member Functions | |
albaStorageElement (albaStorageElement *parent, albaStorage *storage) | |
albaStorageElement * | StoreObject (const char *name, albaStorable *storable, const char *type_name) |
void | SetStorage (albaStorage *storage) |
void | SetParent (albaStorageElement *element) |
Protected Attributes | |
albaStorage * | m_Storage |
albaStorageElement * | m_Parent |
std::vector< albaStorageElement * > * | m_Children |
Abstract class representing the interface for the unit of information stored in the storage.
Abstract class representing the interface for the unit of information stored into a storage. A number of utility functions are defined to store and restore basic objects into the element. More complex serialization algorithms can be implemented by specific "serializable" objects. Among the others, the RestoreObject() function is a function which try to restore a albaObject from element, by creating a new instance from the object factory, taking the object name from the "Type" attribute, and then calling the Restore function of the newly create object. The newly created object must also be a "albaStorable" to support the Restore() function. This abstract class does not implement any real encoding, and subclasses can define specialized de/serialization algorithm.
Definition at line 45 of file albaStorageElement.h.
typedef std::vector<albaStorageElement *> albaStorageElement::ChildrenVector |
Definition at line 175 of file albaStorageElement.h.
|
virtual |
|
protected |
elements can be created only by means of AppendChild() or FindNestedElement()
|
pure virtual |
get the name of this element.
The element name is set at creation time (
Implemented in albaXMLElement.
|
pure virtual |
Set an attribute of this element.
Attribute 'name' and 'value' must be passed as argument.
Implemented in albaXMLElement.
void albaStorageElement::SetAttribute | ( | const char * | name, |
const albaID | value | ||
) |
void albaStorageElement::SetAttribute | ( | const char * | name, |
const double | value | ||
) |
|
pure virtual |
bool albaStorageElement::GetAttributeAsDouble | ( | const char * | name, |
double & | value | ||
) |
Return an attribute value given its name, converting it to double.
Return false if attribute is not found.
bool albaStorageElement::GetAttributeAsInteger | ( | const char * | name, |
albaID & | value | ||
) |
Return an attribute value given its name, converting it to integer.
Return false if attribute is not found.
albaString albaStorageElement::UpgradeAttribute | ( | const char * | attribute | ) |
Used to upgrade attribute value from previous MSF file version.
|
pure virtual |
Implemented in albaXMLElement.
|
pure virtual |
Implemented in albaXMLElement.
|
pure virtual |
Implemented in albaXMLElement.
|
pure virtual |
Implemented in albaXMLElement.
|
pure virtual |
Implemented in albaXMLElement.
|
pure virtual |
Implemented in albaXMLElement.
|
pure virtual |
store a vector of strings into an XML element, and stores single items in "tag" sub elements
Implemented in albaXMLElement.
int albaStorageElement::RestoreMatrix | ( | const char * | name, |
albaMatrix * | matrix | ||
) |
Store 8bit binary data.
Not yet supported. Store 16bit binary data. Not yet supported. Store 32bit binary data. Not yet supported. Restore 8bit binary data. Not yet supported. Restore 16bit binary data. Not yet supported. Restore 32bit binary data. Not yet supported.
int albaStorageElement::RestoreVectorN | ( | const char * | name, |
double * | comps, | ||
unsigned int | num | ||
) |
int albaStorageElement::RestoreVectorN | ( | const char * | name, |
int * | comps, | ||
unsigned int | num | ||
) |
int albaStorageElement::RestoreVectorN | ( | const char * | name, |
std::vector< double > & | comps, | ||
unsigned int | num | ||
) |
int albaStorageElement::RestoreVectorN | ( | const char * | name, |
std::vector< int > & | comps, | ||
unsigned int | num | ||
) |
int albaStorageElement::RestoreVectorN | ( | const char * | name, |
std::vector< albaString > & | comps, | ||
unsigned int | num, | ||
const char * | tag | ||
) |
restore a vector of strings from an XML element, where single items are stored in "tag" sub elements
int albaStorageElement::RestoreText | ( | const char * | name, |
char *& | buffer | ||
) |
int albaStorageElement::RestoreText | ( | const char * | name, |
albaString & | buffer | ||
) |
|
pure virtual |
Implemented in albaXMLElement.
|
pure virtual |
Implemented in albaXMLElement.
|
pure virtual |
Implemented in albaXMLElement.
|
pure virtual |
Implemented in albaXMLElement.
|
pure virtual |
Implemented in albaXMLElement.
|
pure virtual |
restore a vector of strings from an XML element, where single items are stored in "tag" sub elements
Implemented in albaXMLElement.
|
pure virtual |
Implemented in albaXMLElement.
|
virtual |
int albaStorageElement::StoreDouble | ( | const char * | name, |
const double & | value | ||
) |
int albaStorageElement::RestoreDouble | ( | const char * | name, |
double & | value | ||
) |
int albaStorageElement::RestoreDouble | ( | double & | value | ) |
int albaStorageElement::StoreInteger | ( | const char * | name, |
const int & | value | ||
) |
int albaStorageElement::RestoreInteger | ( | const char * | name, |
int & | value | ||
) |
int albaStorageElement::RestoreInteger | ( | int & | value | ) |
int albaStorageElement::RestoreObject | ( | const char * | name, |
albaStorable * | object | ||
) |
Function to try restoring a albaObject from a albaStorageElement.
If the element has an attribute with name "Type", the function try to instantiate an object with the same name and to restore it from the element. In case of problems the function return NULL. The new object is always created by means of New(), this way in case of smart object it can be registered. The object to be restored must be both a albaObject (to stay in the object factory) and a albaStorable to support Restore() method.
albaObject * albaStorageElement::RestoreObject | ( | const char * | name | ) |
Restore object from given element.
albaObject * albaStorageElement::RestoreObject | ( | ) |
Restore object from given element.
albaStorageElement * albaStorageElement::StoreObject | ( | const char * | name, |
albaObject * | object | ||
) |
Used for storing a albaObjects.
The function simply creates a new element with given 'name' and add an attribute with name 'Type' storing the object name. Then the function calls the Store function of the object. The object must be a storable object to support Store() interface. The newly stored element is returned if OK, NULL in case of problems
|
virtual |
|
virtual |
Restore a vector of objects.
Objects must be both albaObject and albaStorable
|
virtual |
Restore a vector of objects.
Objects must be both albaObject and albaStorable
|
inline |
return a pointer to the storage who created this element
Definition at line 162 of file albaStorageElement.h.
|
inline |
return a pointer to the parent element, i.e.
the element upper in the hierarchy
Definition at line 165 of file albaStorageElement.h.
|
pure virtual |
Create a new child element and return its pointer.
This is the only way to create a new element. The first element (the root) is automatically created by storage object.
Implemented in albaXMLElement.
|
virtual |
Find a nested element by Name.
|
pure virtual |
Return the list of children.
Subclasses must implement this to build the children list.
Implemented in albaXMLElement.
|
virtual |
Return the list of all children with a given name.
return true if at least one found.
|
protected |
commodity function to store a storable object creating on the fly the element to store it inside.
|
inlineprotected |
Definition at line 193 of file albaStorageElement.h.
|
inlineprotected |
Definition at line 194 of file albaStorageElement.h.
|
protected |
storage who created this element
Definition at line 196 of file albaStorageElement.h.
|
protected |
the parent element in the hierarchy
Definition at line 197 of file albaStorageElement.h.
|
protected |
children elements
Definition at line 198 of file albaStorageElement.h.