GlobalObjects
Loading...
Searching...
No Matches
glo::ClassInfoIndex::IndexAttributeItem Class Reference

Information for the index about which attribute from which class, with how many characters, belongs to the index. More...

#include <GloClassInfoIndex.h>

Public Member Functions

 IndexAttributeItem (const IndexAttributeItem &rT)
 
 IndexAttributeItem (const std::string &rsIndexPath, int iSignificantCharacter, bool bIsNum)
 
 IndexAttributeItem (const std::vector< AttributeID > &rIndexPathVector, int iSignificantCharacter, bool bIsNum)
 
virtual ~IndexAttributeItem ()
 
int adjustAttributeTypeIfExisting (const AttributeID &rAttributeID, EnDataType eNewType, SchemaInterface *pSchemaInterface)
 
bool changeAtributeIdIfExisting (const AttributeID &rExistingAttributeID, const AttributeID &rNewAttributeID)
 
int eraseAttributeIdIfExisting (const AttributeID &rAttributeID)
 
long getAttributeIdPositionInIndex (const AttributeID &rAttributeID) const
 
std::vector< AttributeIDgetIndexPath () const
 
std::string getIndexPathAsIdString () const
 
std::string getIndexPathAsNameString (const SchemaInterface &rSchemaInterface) const
 
std::size_t getIndexPathSize () const
 
bool getIsNum () const
 
AttributeID getLastIndexClassInfoAttribute () const
 
int getSignificantCharacter () const
 
bool isInIndexPath (const AttributeID &rAttributeID) const
 
ClassInfoIndex::IndexAttributeItemoperator= (const IndexAttributeItem &rT)
 
void setIndexPath (const std::string &rsIndexPath)
 
void setIndexPath (const std::vector< AttributeID > &rIndexPathVector)
 
void setIsNum (bool bIsNum)
 
void setSignificantCharacter (int iSignificantCharacter)
 
bool operator== (const ClassInfoIndex::IndexAttributeItem &rT) const
 Comparison operator, all attributes are compared.
 
bool operator!= (const ClassInfoIndex::IndexAttributeItem &rT) const
 Comparison operator, all attributes are compared.
 

Private Member Functions

 IndexAttributeItem ()
 

Private Attributes

bool m_bIsNum
 
int m_iInstanzInfo
 
std::vector< AttributeIDm_IndexPathVector
 
int m_iSignificantCharacter
 

Detailed Description

Information for the index about which attribute from which class, with how many characters, belongs to the index.

Author
Helmut Jakoby

Constructor & Destructor Documentation

◆ IndexAttributeItem() [1/4]

glo::ClassInfoIndex::IndexAttributeItem::IndexAttributeItem ( )
private

The default constructor is not available.

◆ IndexAttributeItem() [2/4]

glo::ClassInfoIndex::IndexAttributeItem::IndexAttributeItem ( const std::vector< AttributeID > & rIndexPathVector,
int iSignificantCharacter,
bool bIsNum )

Constructor with parameter passing.

Parameters
[in]rIndexPathVectorThe path to the index. See also m_IndexPathVector.
[in]iSignificantCharacterThe number of characters used for the index. If 0, all characters are significant.
[in]bIsNumIf true, the index is considered a number (spaces are inserted at the beginning if necessary). If false, the index is a string (Spaces are appended to the end of the index).

◆ IndexAttributeItem() [3/4]

glo::ClassInfoIndex::IndexAttributeItem::IndexAttributeItem ( const std::string & rsIndexPath,
int iSignificantCharacter,
bool bIsNum )

Constructor with parameter passing.

Parameters
[in]rsIndexPathThe path to the index as string, where the individual AttributeID's are separated by a dot.
E.g.: if the delivered string looks like this: "4.34.6.2.5.5" this means that the index path consists of three AttributeID's -> '4.34', '6.2' and '5.5'. the first digit is the class ID and the second digit the unique position.
[in]iSignificantCharacterThe number of characters used for the index. If 0, all characters are significant.
[in]bIsNumIf true, the index is considered a number (spaces are inserted at the beginning if necessary). If false, the index is a string (Spaces are appended to the end of the index).

◆ IndexAttributeItem() [4/4]

glo::ClassInfoIndex::IndexAttributeItem::IndexAttributeItem ( const IndexAttributeItem & rT)

Copy constructor.

Parameters
[in]rTThe data is copied from this object.

◆ ~IndexAttributeItem()

virtual glo::ClassInfoIndex::IndexAttributeItem::~IndexAttributeItem ( )
virtual

Destructor.

Member Function Documentation

◆ adjustAttributeTypeIfExisting()

int glo::ClassInfoIndex::IndexAttributeItem::adjustAttributeTypeIfExisting ( const AttributeID & rAttributeID,
EnDataType eNewType,
SchemaInterface * pSchemaInterface )

Checks if passed AttributeID is included in the m_IndexPathVector.
If contained as path to the actual index attribute, the type may only be ClassInfoAttribute::eEMBEDDED and ClassInfoAttribute::ePOINTER.
If contained as the actual index attribute, ClassInfoIndex::IndexAttributeItem::m_iSignificantCharacter (will only be shortened if necessary, otherwise left as it is) and ClassInfoIndex::IndexAttributeItem::m_bIsNum may be adapted to the new type or, if not suitable as an index attribute, removed from the index.

Parameters
[in]rAttributeIDThe AttributeID for whose corresponding attribute a type change was made.
[in]eNewTypeThe new type of the attribute.
[in]pSchemaInterfaceThe SchemaInterface is used to check attributes.
Returns
If 1, the index entry could be adjusted.
If 0, passed AttributeID is not included in m_IndexPathVector or nothing was done (e.g. eNewType was already).
A value < 0 indicates an error or an adjustment is not possible.

◆ changeAtributeIdIfExisting()

bool glo::ClassInfoIndex::IndexAttributeItem::changeAtributeIdIfExisting ( const AttributeID & rExistingAttributeID,
const AttributeID & rNewAttributeID )

Checks if the first passed AttributeID is contained in the m_IndexPathVector and changes it to the second passed AttributeID.
If e.g. the position of an atrtribute in a ClassInfo has changed, the AttributeID::m_ulFieldPos in the AttributeID changes. To ensure that an index attribute points to the correct attribute, all entries in the m_IndexPathVector are checked here and adjusted if necessary.

Parameters
[in]rExistingAttributeIDThe AttributeID to be changed.
[in]rNewAttributeIDThe AttributeID with the values to be adopted.
Returns
If true, a AttributeID with values of rExistingAttributeID exists in the m_IndexPathVector and has been changed to the values of rNewAttributeID.
Note
If rExistingAttributeID and rNewAttributeID are equal, no action is taken and false is returned.

◆ eraseAttributeIdIfExisting()

int glo::ClassInfoIndex::IndexAttributeItem::eraseAttributeIdIfExisting ( const AttributeID & rAttributeID)

Checks if passed AttributeID is included in the m_IndexPathVector and removes this entry.

Parameters
[in]rAttributeIDThe AttributeID.
Returns
If 1, the index entry has been removed.
If 0, the passed AttributeID is not included in m_IndexPathVector.
A value ERR_CORRUPT_INDEX means that the last entry has been removed.

◆ getAttributeIdPositionInIndex()

long glo::ClassInfoIndex::IndexAttributeItem::getAttributeIdPositionInIndex ( const AttributeID & rAttributeID) const

Checks if passed AttributeID is contained in the m_IndexPathVector and returns the position in the m_IndexPathVector.

Parameters
[in]rAttributeIDThe AttributeID to check.
Returns
If ERR_RANGE, the attributeID was not found in the m_IndexPathVector.
Otherwise, this is the position (starting at 0) in the m_IndexPathVector where the passed attributeID is referenced.

◆ getIndexPath()

std::vector< AttributeID > glo::ClassInfoIndex::IndexAttributeItem::getIndexPath ( ) const

Returns the index path from m_IndexPathVector as a copy.

Returns
The IndexPathVector.

◆ getIndexPathAsIdString()

std::string glo::ClassInfoIndex::IndexAttributeItem::getIndexPathAsIdString ( ) const

Returns the index path from m_IndexPathVector as a string, with the individual AttributeID's separated by a dot.
E.g.: if the delivered string looks like this: "4.34.6.2.5.5" this means that the index path consists of three AttributeID's -> '4.34', '6.2' and '5.5'. the first digit is the class ID and the second digit the unique position.

Returns
The IndexPath as string.
See also
AttributeID

◆ getIndexPathAsNameString()

std::string glo::ClassInfoIndex::IndexAttributeItem::getIndexPathAsNameString ( const SchemaInterface & rSchemaInterface) const

Returns the index path from m_IndexPathVector as a string with the individual class and attribute names separated by a dot.

Parameters
[in]rSchemaInterfaceThe SchemaInterface is used to get the names of the index attributes.
Returns
The IndexPath as string.

◆ getIndexPathSize()

std::size_t glo::ClassInfoIndex::IndexAttributeItem::getIndexPathSize ( ) const

Returns the number of entries (size) of m_IndexPathVector.

◆ getIsNum()

bool glo::ClassInfoIndex::IndexAttributeItem::getIsNum ( ) const

Returns whether the index is numeric or not. If true, the index is considered as a number (spaces are inserted at the beginning if necessary). If false, the index is treated as a string (blanks are appended to the end if necessary).

Returns
See description.

◆ getLastIndexClassInfoAttribute()

AttributeID glo::ClassInfoIndex::IndexAttributeItem::getLastIndexClassInfoAttribute ( ) const

Returns the AttributeID from the m_IndexPathVector of the last class attribute in the index path.

Returns
The last AttributeID from the index path. If this NULL_PTR, which should always be checked, there is no index path.

◆ getSignificantCharacter()

int glo::ClassInfoIndex::IndexAttributeItem::getSignificantCharacter ( ) const

Returns the number of characters used for the index. If 0, all characters are significant.

Returns
The number of characters used for the index.

◆ isInIndexPath()

bool glo::ClassInfoIndex::IndexAttributeItem::isInIndexPath ( const AttributeID & rAttributeID) const

Checks if passed AttributeID is included in the m_IndexPathVector.

Parameters
[in]rAttributeIDThe AttributeID to check.
Returns
If true, the passed AttributeID is in the m_IndexPathVector.

◆ operator!=()

bool glo::ClassInfoIndex::IndexAttributeItem::operator!= ( const ClassInfoIndex::IndexAttributeItem & rT) const

Comparison operator, all attributes are compared.

Parameters
[in]rTThe object to be compared with this one.

◆ operator=()

ClassInfoIndex::IndexAttributeItem & glo::ClassInfoIndex::IndexAttributeItem::operator= ( const IndexAttributeItem & rT)

Assignment operator.

Parameters
[in]rTThe data is transferred from this object.

◆ operator==()

bool glo::ClassInfoIndex::IndexAttributeItem::operator== ( const ClassInfoIndex::IndexAttributeItem & rT) const

Comparison operator, all attributes are compared.

Parameters
[in]rTThe object to be compared with this one.

◆ setIndexPath() [1/2]

void glo::ClassInfoIndex::IndexAttributeItem::setIndexPath ( const std::string & rsIndexPath)

Sets the index path in m_IndexPathVector from passed string, where the individual AttributeID's are separated by a dot.
E.g.: if the delivered string looks like this: "4.34.6.2.5.5" this means that the index path consists of three AttributeID's -> '4.34', '6.2' and '5.5'. the first digit is the class ID and the second digit the unique position.

Parameters
[in]rsIndexPathThe index path.

◆ setIndexPath() [2/2]

void glo::ClassInfoIndex::IndexAttributeItem::setIndexPath ( const std::vector< AttributeID > & rIndexPathVector)

Sets the index path in m_IndexPathVector.

Parameters
[in]rIndexPathVectorThe index path.

◆ setIsNum()

void glo::ClassInfoIndex::IndexAttributeItem::setIsNum ( bool bIsNum)

Marks the index as numeric or not. If true, the index is considered as a number (spaces are inserted at the beginning if necessary). If false, the index is treated as a string (blanks are appended to the end if necessary).

Parameters
[in]bIsNumSee description.

◆ setSignificantCharacter()

void glo::ClassInfoIndex::IndexAttributeItem::setSignificantCharacter ( int iSignificantCharacter)

Setzt Anzahl der Zeichen welche für den Index genutzt werden. Wenn 0, sind alle Zeichen signifikant.

Parameters
[in]iSignificantCharacterDie Anzahl der Zeichen welche für den Index genutzt werden.

Member Data Documentation

◆ m_bIsNum

bool glo::ClassInfoIndex::IndexAttributeItem::m_bIsNum
private

If true, the index is considered a number (spaces are inserted at the beginning if necessary). If false, the index is treated as a string (Spaces are appended to the end if necessary).

◆ m_iInstanzInfo

int glo::ClassInfoIndex::IndexAttributeItem::m_iInstanzInfo
private

For debugging purposes, a value != 0 can be written in here when instantiating.
A breakpoint must be set in the ctor's and dtor for the assignment "XXX".
m_iInstanzInfo is queried in the dtor and stopped at the breakpoint at "iXXX" when != 1.
What's the point of all this? For example, if several objects of this class are instantiated and only a part is removed from memory.
If you know the location where the particular object that creates a memory leak is instantiated, a breakpoint can be set there. In the ctor of the object of this class, m_iInstanzInfo is assigned a unique value. By querying the dtor you can now determine which object is not removed from memory.

◆ m_IndexPathVector

std::vector< AttributeID > glo::ClassInfoIndex::IndexAttributeItem::m_IndexPathVector
private

An index path is always structured as follows: "Class name.attribute name".
The class name must always be that of the class or superclass of the object to be indexed. The attribute name is the attribute which is used in the index.
Since a class can have an embedded class as an attribute, the attributes of the embedded classes can be used for indexing.
Such an index is always structured as follows: "Class name.attribute name.2_Class name.2_Attribute name[20]".
In this vector, the index path is realized by the contained objects of type AttributeID.

See also
AttributeID

◆ m_iSignificantCharacter

int glo::ClassInfoIndex::IndexAttributeItem::m_iSignificantCharacter
private

The number of characters used for the index. If 0, all characters are significant.


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