#include <datacontainer.h>
Inheritance diagram for DataContainer:
Public Member Functions | |
DataContainer construction functions | |
DataContainer () | |
DataContainer (DataContainer &aDataContainer) | |
virtual | ~DataContainer () |
Accessor functions | |
bool | hasStringDescriptor (string aLabel) |
bool | hasFloatDescriptor (string aLabel) |
bool | hasIntDescriptor (string aLabel) |
DataContainer manipulation functions | |
Descriptor< int > * | addKindIntDescriptor (string aLabel, int aValue, string aUnit, string aComment) |
Descriptor< int > * | addKindIntDescriptor (Descriptor< int > *aDescriptor) |
Descriptor< float > * | addKindFloatDescriptor (string aLabel, float aValue, string aUnit, string aComment) |
Descriptor< float > * | addKindFloatDescriptor (Descriptor< float > *aDescriptor) |
Descriptor< string > * | addKindStringDescriptor (string aLabel, string aValue, string aUnit, string aComment) |
Descriptor< string > * | addKindStringDescriptor (Descriptor< string > *aDescriptor) |
Descriptor< int > * | addIntDescriptor (string aLabel, int aValue, string aUnit, string aComment) |
Descriptor< float > * | addFloatDescriptor (string aLabel, float aValue, string aUnit, string aComment) |
Descriptor< string > * | addStringDescriptor (string aLabel, string aValue, string aUnit, string aComment) |
Descriptor< int > * | setIntDescriptor (string aLabel, int aValue, string aUnit, string aComment, bool addIfMissing, bool silentError) |
Descriptor< float > * | setFloatDescriptor (string aLabel, float aValue, string aUnit, string aComment, bool addIfMissing, bool silentError) |
Descriptor< string > * | setStringDescriptor (string aLabel, string aValue, string aUnit, string aComment, bool addIfMissing, bool silentError) |
Descriptor< int > * | getIntDescriptor (string aLabel, bool silentError=true) throw ( CError ) |
long | getPossibleValuesInIntDescriptor (string aDescriptorName, vector< int > *) |
Descriptor< float > * | getFloatDescriptor (string aLabel, bool silentError=true) throw ( CError ) |
Descriptor< string > * | getStringDescriptor (string aLabel, bool silentError=true) throw ( CError ) |
virtual bool | deleteDescriptor (string aString, bool found=false) |
void | deleteAllDescriptors () |
void | addUnknownTypeDescriptor (string aName, string aValue) |
Iterators | |
map< string, Descriptor< int > * >::iterator | beginIntDescriptor () |
map< string, Descriptor< int > * >::iterator | endIntDescriptor () |
map< string, Descriptor< float > * >::iterator | beginFloatDescriptor () |
map< string, Descriptor< float > * >::iterator | endFloatDescriptor () |
map< string, Descriptor< string > * >::iterator | beginStringDescriptor () |
map< string, Descriptor< string > * >::iterator | endStringDescriptor () |
Output functions | |
void | describe () throw ( CError ) |
void | describeShort () throw ( CError ) |
Protected Member Functions | |
void | deleteAllKindDescriptors () |
Protected Attributes | |
bool | flagElement |
map< string, Descriptor< int > * > | intDescriptors |
map< string, Descriptor< float > * > | floatDescriptors |
map< string, Descriptor< string > * > | stringDescriptors |
map< string, Descriptor< int > * > * | kindIntDescriptors |
map< string, Descriptor< float > * > * | kindFloatDescriptors |
map< string, Descriptor< string > * > * | kindStringDescriptors |
FOR: SNSF SPONSORED PROJECT
PURPOSE: Base Class implementing a collection of Descriptors and a collection of kind Descriptors ( of types int, float, and string )
DataContainer is a base class to be used to derive classs representing concepts which need to be described with real values (properties)
We distinguish two kind of properties: unique descriptors and kind descriptors. Unique descriptors are properties whose values are unique to an instance of the concept. Kind descriptors are properties whose values are shared among a group of concept instances.
For example the class Atom is derived from DataContainer. Atoms have unique descriptors like a name, a start and stop probability. On the other hand atoms have many kind descriptors which are shared among atoms belonging to the same chemical element. The atomic number of all hydrogens is the same, but is different for carbons. Kind descriptors allow for this.
Kind desriptors are stored only once in memory and are then referenced by all class instances of the same kind can therefore be added at any time but should be removed with caution since many class instances may point to it. In chemcpp generic instances of Atoms are instanciated globally in the elements.h file by creation of an Elements instance and stored in the elements map. Kind descriptors are created at that time and will only be deleted with the deletion of the unique instance of Elements.
Memory allocation for unique descriptors on the other hand can be managed by the DataContainer class itself since only one instance of the derived class points to them. So deletion of the DataContainer causes the deletion of the descriptors.
|
class constructor. |
|
class constructor. |
|
(virtual) class desctructor. |
|
adds a float unique descriptor with a label, value, unit and comment. this descriptor will be deleted with the destruction of this class.
|
|
adds an integer unique descriptor with a label, value, unit and comment. this descriptor will be deleted with the destruction of this class. |
|
adds an existing float descriptor to the float kind descriptor container. WARNING this descriptor will be deleted with the destruction of the Elements class. |
|
adds an float kind descriptor with a label, value, unit and comment to the float kind descriptor container. WARNING this descriptor will be deleted with the destruction of the Elements class. |
|
adds an existing int descriptor to the int kind descriptor container. WARNING this descriptor will be deleted with the destruction of the Elements class. |
|
adds an integer kind descriptor with a label, value, unit and comment to the int kind descriptor container. WARNING this descriptor will be deleted with the destruction of the Elements class. |
|
adds an existing string descriptor to the string kind descriptor container. WARNING this descriptor will be deleted with the destruction of the Elements class. |
|
adds a string kind descriptor with a label, value, unit and comment to the string kind descriptor container. WARNING this descriptor will be deleted with the destruction of the Elements class. |
|
adds a string unique descriptor with a label, value, unit and comment. this descriptor will be deleted with the destruction of this class. |
|
adds a descriptor to the datacontainer. If aName terminates with .string, a string descriptor will be added. If the aName terminates with a .integer, an integer descriptor will be added. If aName terminates with .float, a float descriptor will be added. |
|
start iterator for float descriptors. |
|
start iterator for int descriptors. |
|
start iterator for string descriptors. |
|
deletes all unique descriptors from ***Descriptors. deletes the objects and removes pointer from the Hash, does not remove kind descriptors. |
|
called by the destructor if flagElement == true. |
|
deletes the unique descriptor aString from Descriptors. deletes the object and removes pointer from the Hash, does not remove kind descriptors. |
|
writes a description of all labels to cout (unique and kind descriptors). |
|
writes a description of unique descriptors only to cout (no kind descriptors). |
|
end iterator for float descriptors. |
|
end iterator for int descriptors. |
|
end iterator for string descriptors. |
|
returns a float property (unique or kind descriptor).
|
|
returns a int property (unique or kind descriptor). |
|
fills a vector with the possible values of a int descriptor and returns the number of possible values. |
|
returns a string property (unique or kind descriptor). |
|
returns true if the datacontainer has a float descriptor with label aLabel. |
|
returns true if the datacontainer has an int descriptor with label aLabel. |
|
returns true if the datacontainer has a string descriptor with label aLabel. |
|
sets the value of float label (unique or kind descriptor). |
|
sets the value of an int label (unique or kind descriptor). |
|
sets the value of a string label (unique or kind descriptor). |
|
false if this datacontainer was constructed by copy of an existingdatacontainer. Useful for destruction. |
|
hash of pointers on Float descriptors. |
|
hash of pointers on Integer descriptors. |
|
hash of pointers on Float kind descriptors. |
|
hash of pointers on Integer kind descriptors. |
|
hash of pointers on String kind descriptors. |
|
hash of pointers on String descriptors. |