GlobalObjects
|
This class contains all information to store objects of a class in a database, to build objects from tables and to build tables from objects. More...
#include <GloClassInfo.h>
Classes | |
class | SuperClassIdInfoTuple |
This parameter class is used to deliver and receive the Superclass IDs with additional information. More... | |
Public Member Functions | |
ClassInfo () | |
ClassInfo (const ClassInfo &rT) | |
ClassInfo (const std::string &rsSchemaName, const std::string &rsName, unsigned long ulClassID, const std::string &rsSuperClasses, const std::string &rsSuperClassesInfo) | |
virtual | ~ClassInfo () |
std::string | _DEBUG_ToString () |
bool | asSubClassAvailable (unsigned long ulSubClassID) const |
bool | attributeExisting (ClassInfoAttribute *pAttribute) const |
bool | attributeExisting (const std::string &rsAttributeName) const |
int | attributeFieldNameExisting (const std::string &rsAttributeFieldName) |
void | deleteAllInfoAttributes () |
void | deleteAllInfoIndexes () |
std::string | getAllAttributeFildNamesAsColumnRow (char cColumnDelimiter=g_cTableColumnDelimiter) const |
void | getAllAttributesSortByFieldPos (std::map< int, ClassInfoAttribute *, std::less< int > > &rRetValMap) const |
void | getAllClassMemberNamesSortByID (std::map< AttributeID, std::string > &rRetValMap) const |
ClassInfoAttribute * | getAttribute (EnSeekMode eMode) |
ClassInfoAttribute * | getAttributeByFieldName (const std::string &rsTableName, const std::string &rsFieldName) const |
ClassInfoAttribute * | getAttributeByID (const AttributeID &rAttributeID) const |
ClassInfoAttribute * | getAttributeByName (const std::string &rsName) const |
std::string | getClassDescription () const |
unsigned long | getClassID () const |
std::string | getClassModifier () const |
std::string | getClassName () const |
std::string | getFileDescription () const |
std::string | getFileName () const |
ClassInfoIndex * | getIndex (EnSeekMode eMode) |
void | getIndexes (std::vector< AllSetIndexInfo > &rIndexes) const |
ClassInfoIndex * | getIndexFromName (const std::string &rsIndexName) const |
std::string | getName () const |
void | getNamespaces (std::vector< std::string > &rNamespaces) const |
std::size_t | getNumberOfAttributes () const |
std::size_t | getNumberOfIndexes () const |
std::string | getSchemaName () const |
std::list< ClassInfo * > & | getSubClassInfos () |
std::string | getSuperClasses () const |
void | getSuperClasses (std::vector< unsigned long > &rSuperClassIdVector) const |
std::string | getSuperClassesInfo () const |
void | getSuperClassesInfo (std::vector< std::string > &rSuperClassesInfoVector) const |
void | getSuperClassesInfoTuples (std::vector< std::shared_ptr< SuperClassIdInfoTuple > > &rSuperClassesInfoTuplesVector) const |
std::string | getTableNameFirstAttribute () const |
int | indexExisting (ClassInfoIndex *pIndex) const |
int | indexExisting (const std::string &rsIndexName) const |
void | insertSubClassInfo (ClassInfo *pSubClassInfo) |
bool | isDirectSubclassOf (unsigned long ulSuperClassID) const |
ClassInfo & | operator= (const ClassInfo &rT) |
int | removeAttribute (ClassInfoAttribute *pAttribute, bool bDelete=false) |
int | removeIndex (ClassInfoIndex *pIndex, bool bDelete=false) |
void | removeSubClassInfo (unsigned long ulClassID) |
void | setAllAttributesTableName (const std::string &rsTableName) const |
void | setClassDescription (const std::string &rstrClassDescription) |
void | setClassID (unsigned long ulClassID) |
void | setClassModifier (const std::string &rstrClassModifier) |
void | setFileDescription (const std::string &rstrFileDescription) |
void | setFileName (const std::string &rsFileName) |
void | setName (const std::string &rsName) |
void | setSchemaName (const std::string &rsSchemaName) |
void | setSuperClasses (const std::string &rsSuperClasses) |
void | setSuperClassesInfo (const std::string &rsSuperClassesInfo) |
void | setSuperClassesInfoTuples (const std::vector< std::shared_ptr< SuperClassIdInfoTuple > > &rSuperClassesInfoTuplesVector) |
int | takeOverAttribute (ClassInfoAttribute *pAttribute) |
int | takeOverIndex (ClassInfoIndex *pIndex) |
Private Member Functions | |
void | copyAttributListFrom (const ClassInfo &rT) |
void | copyIndexListFrom (const ClassInfo &rT) |
Private Attributes | |
std::list< ClassInfoAttribute * > | m_AttributeList |
std::list< ClassInfoAttribute * >::iterator | m_AttributeListIterator |
std::list< ClassInfoIndex * > | m_IndexList |
std::list< ClassInfoIndex * >::iterator | m_IndexListIterator |
std::string | m_sClassDescription |
std::string | m_sClassModifier |
std::string | m_sFileDescription |
std::string | m_sFileName |
std::string | m_sName |
std::string | m_sSchemaName |
std::string | m_sSuperClasses |
std::string | m_sSuperClassesInfo |
std::list< ClassInfo * > | m_SubClassInfoList |
unsigned long | m_ulClassID |
Friends | |
class | SchemaInterface |
This class contains all information to store objects of a class in a database, to build objects from tables and to build tables from objects.
The SchemaInterface provides an object of this class for each class.
glo::ClassInfo::ClassInfo | ( | ) |
Standard constructor.
glo::ClassInfo::ClassInfo | ( | const std::string & | rsSchemaName, |
const std::string & | rsName, | ||
unsigned long | ulClassID, | ||
const std::string & | rsSuperClasses, | ||
const std::string & | rsSuperClassesInfo ) |
Constructor with parameter passing.
[in] | rsSchemaName | The schema respectively database name. |
[in] | rsName | The class name. |
[in] | ulClassID | The class ID. |
[in] | rsSuperClasses | The superclass(es) as class ID separated by '|' (e.g. "3|"). |
[in] | rsSuperClassesInfo | Information about the inheritance of superclass(es) such as "virtual|". |
glo::ClassInfo::ClassInfo | ( | const ClassInfo & | rT | ) |
Copy constructor.
[in] | rT | The data is copied from this object. |
|
virtual |
Destructor.
std::string glo::ClassInfo::_DEBUG_ToString | ( | ) |
Returns the object content as a string.
bool glo::ClassInfo::asSubClassAvailable | ( | unsigned long | ulSubClassID | ) | const |
Checks whether a class with passed class ID is a direct subclass.
[in] | ulSubClassID | The class ID which is checked. |
bool glo::ClassInfo::attributeExisting | ( | ClassInfoAttribute * | pAttribute | ) | const |
Checks whether a class information attribute is included in its list of attributes.
[in] | pAttribute | The class information attribute to be checked. |
bool glo::ClassInfo::attributeExisting | ( | const std::string & | rsAttributeName | ) | const |
Checks whether a class information attribute with the passed name is included in its list of attributes.
[in] | rsAttributeName | The name (from ClassInfoAttribute::getName()) of the class information attribute to be checked. |
int glo::ClassInfo::attributeFieldNameExisting | ( | const std::string & | rsAttributeFieldName | ) |
Checks whether a class information attribute with the passed table field label is included in the list of attributes.
[in] | rsAttributeFieldName | The table field name of the class information attribute to be checked. |
|
private |
Copies from passed class information all class information attributes to its list of attributes.
[in] | rT | The data is transferred from this object. |
|
private |
Copies all class information indexes from transferred class information to its list of indexes.
[in] | rT | The data is transferred from this object. |
void glo::ClassInfo::deleteAllInfoAttributes | ( | ) |
Removes all class information attributes from the list of attributes and from memory.
void glo::ClassInfo::deleteAllInfoIndexes | ( | ) |
Removes all class information indexes from the list of indexes and from memory.
std::string glo::ClassInfo::getAllAttributeFildNamesAsColumnRow | ( | char | cColumnDelimiter = g_cTableColumnDelimiter | ) | const |
Returns all class information attributes as a complete field name line. The individual attributes are separated by g_cTableColumnDelimiter.
For example, if g_cTableColumnDelimiter == '\a': "ObjID[BEL]CreateDate[BEL]LastChange[BEL]"
[in] | cColumnDelimiter | A different delimiter can be passed. |
void glo::ClassInfo::getAllAttributesSortByFieldPos | ( | std::map< int, ClassInfoAttribute *, std::less< int > > & | rRetValMap | ) | const |
Returns all class information attributes sorted by column position.
[in,out] | rRetValMap | The class information attributes. |
void glo::ClassInfo::getAllClassMemberNamesSortByID | ( | std::map< AttributeID, std::string > & | rRetValMap | ) | const |
Returns, of all class information attributes from its list of attributes, the attribute name with class description, separated by a period and sorted by attribute ID (e.g. "MyClass.m_MyAttribute").
[in,out] | rRetValMap | The attribute names with class ID of the class information attributes (see also ClassInfoAttribute::getClassAttributeName()). |
ClassInfoAttribute * glo::ClassInfo::getAttribute | ( | EnSeekMode | eMode | ) |
Returns a class information attribute from its list of attributes related to eMode.
[in] | eMode | The seek mode. |
Parameter examples:
ClassInfoAttribute * glo::ClassInfo::getAttributeByFieldName | ( | const std::string & | rsTableName, |
const std::string & | rsFieldName ) const |
Returns a class information attribute from its list of attributes whose table name and table field name matches the names passed
[in] | rsTableName | The table name of the class information attribute you are looking for. |
[in] | rsFieldName | The table field name of the class information attribute you are looking for. |
ClassInfoAttribute * glo::ClassInfo::getAttributeByID | ( | const AttributeID & | rAttributeID | ) | const |
Returns a class information attribute from its list of attributes whose attribute ID matches the attribute ID passed.
[in] | rAttributeID | The AttributeID of the searched class information attribute. |
ClassInfoAttribute * glo::ClassInfo::getAttributeByName | ( | const std::string & | rsName | ) | const |
Returns a class information attribute from its list of attributes whose name matches the name passed
[in] | rsName | The name of the class information attribute you are looking for. |
std::string glo::ClassInfo::getClassDescription | ( | ) | const |
Returns the class description which can be copied into the generated header file of the class.
unsigned long glo::ClassInfo::getClassID | ( | ) | const |
std::string glo::ClassInfo::getClassModifier | ( | ) | const |
Returns the class modifier like '__declspec(dllexport)' which can be copied into the generated header file of the class between "class" and the class name.
std::string glo::ClassInfo::getClassName | ( | ) | const |
std::string glo::ClassInfo::getFileDescription | ( | ) | const |
Returns the file description which can be copied into the generated header file of the class.
std::string glo::ClassInfo::getFileName | ( | ) | const |
Returns the file name in which the generated header file of the class can be copied.
ClassInfoIndex * glo::ClassInfo::getIndex | ( | EnSeekMode | eMode | ) |
Returns a class information index from its list of indexes related to eMode.
[in] | eMode | The seek mode. |
Parameter examples:
void glo::ClassInfo::getIndexes | ( | std::vector< AllSetIndexInfo > & | rIndexes | ) | const |
Inserts all indexes from its list of indexes into passed Vector rIndexes at the end.
[in,out] | rIndexes | The indexes. |
ClassInfoIndex * glo::ClassInfo::getIndexFromName | ( | const std::string & | rsIndexName | ) | const |
Returns the class information index from its list of indexes whose name matches the name passed.
[in] | rsIndexName | The name of the class information index that is searched for. |
std::string glo::ClassInfo::getName | ( | ) | const |
void glo::ClassInfo::getNamespaces | ( | std::vector< std::string > & | rNamespaces | ) | const |
Returns the namespaces in the transferred vector, if available. For example, if the class name is "toc::roc::MyName", "toc" and "roc" are inserted in the same order in the passed vector.
std::size_t glo::ClassInfo::getNumberOfAttributes | ( | ) | const |
std::size_t glo::ClassInfo::getNumberOfIndexes | ( | ) | const |
std::string glo::ClassInfo::getSchemaName | ( | ) | const |
std::list< ClassInfo * > & glo::ClassInfo::getSubClassInfos | ( | ) |
Returns the reference to the internal list of subclasses.
std::string glo::ClassInfo::getSuperClasses | ( | ) | const |
Returns the superclass(es) as class ID separated by '|' such as "3|4|" => class has two superclasses with the class ID "3" and "4".
void glo::ClassInfo::getSuperClasses | ( | std::vector< unsigned long > & | rSuperClassIdVector | ) | const |
Inserts all class IDs of the direct superclasses into the transferred vector. The transferred vector will be emptied first.
[in,out] | rSuperClassIdVector | The vector in which the class IDs of the direct superclasses are inserted. |
std::string glo::ClassInfo::getSuperClassesInfo | ( | ) | const |
Returns the information about the inheritance of superclass(es). For example, if value is " |virtual|" (first class not virtual, therefore space) and if, for example, in m_sSuperClasses the IDs are "3|4|", then inheritance from the class with ID 4 is virtual.
void glo::ClassInfo::getSuperClassesInfo | ( | std::vector< std::string > & | rSuperClassesInfoVector | ) | const |
Inserts all information about the inheritance of superclass(es) into the passed vector. The transferred Vector is emptied before.
[in,out] | rSuperClassesInfoVector | The vector in which the information is inserted. |
void glo::ClassInfo::getSuperClassesInfoTuples | ( | std::vector< std::shared_ptr< SuperClassIdInfoTuple > > & | rSuperClassesInfoTuplesVector | ) | const |
Inserts all class IDs of the direct superclasses and the corresponding information for inheritance into the vector at the end of the passed vector.
The transferred vector is not emptied before.
[in,out] | rSuperClassesInfoTuplesVector | The vector in which the information is inserted. |
std::string glo::ClassInfo::getTableNameFirstAttribute | ( | ) | const |
Returns the table name of the first attribute (all persistent attributes of a class are stored in one table).
int glo::ClassInfo::indexExisting | ( | ClassInfoIndex * | pIndex | ) | const |
Checks whether a class information index is included in the list of indexes.
[in] | pIndex | The class information index to be checked. |
int glo::ClassInfo::indexExisting | ( | const std::string & | rsIndexName | ) | const |
Checks whether a class information index, with the name passed, is included in the list of indexes.
[in] | rsIndexName | The index name of the class information index to be checked. |
void glo::ClassInfo::insertSubClassInfo | ( | ClassInfo * | pSubClassInfo | ) |
Inserts the transferred class information into the list of subclasses.
[in] | pSubClassInfo | The subclass to be inserted. |
bool glo::ClassInfo::isDirectSubclassOf | ( | unsigned long | ulSuperClassID | ) | const |
Checks whether the passed class ID is the ID of a direct superclass.
[in] | ulSuperClassID | The class ID to be checked. |
Assignment operator. All attributes except m_SubClassInfoList are considered.
[in] | rT | The data is transferred from this object. |
int glo::ClassInfo::removeAttribute | ( | ClassInfoAttribute * | pAttribute, |
bool | bDelete = false ) |
Removes passed class information attribute from the list of attributes.
[in] | pAttribute | The class information attribute to be removed. |
[in] | bDelete | If true, the class information attribute to be removed is removed from memory if it is found. The delivered attribute is no longer valid. If false, the passed attribute remains the responsibility of the calling instance; must be removed from memory by the calling instance. |
int glo::ClassInfo::removeIndex | ( | ClassInfoIndex * | pIndex, |
bool | bDelete = false ) |
Removes transferred class information index from the list of indexes.
[in] | pIndex | The class information index to be removed. |
[in] | bDelete | If true, the class information index to be removed will be removed from memory if found. The delivered index is not valid anymore. If false, the passed index remains the responsibility of the calling instance; therefore it must be removed from memory by the calling instance. |
void glo::ClassInfo::removeSubClassInfo | ( | unsigned long | ulClassID | ) |
Removes the class information with passed ClassID from its list of subclasses if available.
void glo::ClassInfo::setAllAttributesTableName | ( | const std::string & | rsTableName | ) | const |
Sets in all class information attributes from its list of attributes the table name with passed value.
[in] | rsTableName | The table name to be set. |
void glo::ClassInfo::setClassDescription | ( | const std::string & | rstrClassDescription | ) |
Sets the class description which can be copied into the generated header file of the class.
[in] | rstrClassDescription | The class description. |
void glo::ClassInfo::setClassID | ( | unsigned long | ulClassID | ) |
void glo::ClassInfo::setClassModifier | ( | const std::string & | rstrClassModifier | ) |
Sets the class modifier like '__declspec(dllexport)' which can be copied into the generated header file of the class between "class" and the class name.
[in] | rstrClassModifier | The class modifier. |
void glo::ClassInfo::setFileDescription | ( | const std::string & | rstrFileDescription | ) |
Sets the file description which can be copied into the generated header file of the class.
[in] | rstrFileDescription | The file description. |
void glo::ClassInfo::setFileName | ( | const std::string & | rsFileName | ) |
Sets the file name in which the generated header file of the class can be copied.
[in] | rsFileName | The file name. |
void glo::ClassInfo::setName | ( | const std::string & | rsName | ) |
Sets the class name.
[in] | rsName | The class name. |
void glo::ClassInfo::setSchemaName | ( | const std::string & | rsSchemaName | ) |
Sets the schema respectively database name.
[in] | rsSchemaName | The schema respectively database name. |
void glo::ClassInfo::setSuperClasses | ( | const std::string & | rsSuperClasses | ) |
Sets the superclass(es) as class ID separated by '|' such as "3|4|" => class has two superclasses with the class ID "3" and "4".
[in] | rsSuperClasses | The superclass(es). |
void glo::ClassInfo::setSuperClassesInfo | ( | const std::string & | rsSuperClassesInfo | ) |
Sets the information about inheritance of superclass(es). For example, if value is " |virtual|" (first class not virtual, therefore space) and if, for example, in m_sSuperClasses the IDs are "3|4|", then inheritance from the class with ID 4 is virtual.
[in] | rsSuperClassesInfo | The information about inheritance of superclass(es). |
void glo::ClassInfo::setSuperClassesInfoTuples | ( | const std::vector< std::shared_ptr< SuperClassIdInfoTuple > > & | rSuperClassesInfoTuplesVector | ) |
Adopts all class IDs and the corresponding information for inheritance from the transferred vector as superclasses.
[in] | rSuperClassesInfoTuplesVector | The vector with the information. |
int glo::ClassInfo::takeOverAttribute | ( | ClassInfoAttribute * | pAttribute | ) |
Adopts passed class information attribute to its list of attributes.
[in] | pAttribute | The class information attribute to be transferred. |
int glo::ClassInfo::takeOverIndex | ( | ClassInfoIndex * | pIndex | ) |
Adopts the transferred class information index into its list of indexes.
[in] | pIndex | The class information index to be transferred. |
|
friend |
|
private |
List of attributes.
|
private |
Internal iterator of the list of attributes.
|
private |
List of indexes.
|
private |
Internal iterator of the list of indexes.
|
private |
The class description which can be copied into the generated header file of the class.
|
private |
A class modifier like '__declspec(dllexport)' which can be copied into the generated header file of the class between "class" and the class name.
|
private |
The file description which can be copied into the generated header file of the class.
|
private |
The file name in which the generated header file of the class is written.
|
private |
The class name.
|
private |
Is set by the schema and is equivalent with the database name.
|
private |
The superclass/s as class ID separated by '|' such as "3|4|" => class has two superclasses with the class ID "3" and "4".
|
private |
Information about inheritance of superclass(es). For example, if value is " |virtual|" (first class not virtual, therefore space) and if, for example, in m_sSuperClasses the IDs are "3|4|", then inheritance from the class with ID 4 is virtual.
|
private |
List of subclasses. Is used by the SchemaInterface (performance). Is copied in the copy constructor and assignment operator not! When the object is fetched from the Base, this list is empty!
|
private |
The unique ID of the class.