GlobalObjects
|
Base class for the individual attributes of a Record. More...
#include <GloBaseRecordAttribute.h>
Public Member Functions | |
BaseRecordAttribute (ClassInfoAttribute *pClassInfoAttribut, const std::streampos &rFilePos) | |
virtual | ~BaseRecordAttribute () |
virtual bool | dataIsFieldContent () const =0 |
unsigned int | forget () |
AttributeID | getAttributeID () const |
virtual int | getAttributeValueBlob (eut::Blob &rBlob) const |
ClassInfoAttribute * | getClassInfoAttribute () const |
std::string | getClassMemberName () const |
std::string | getClassName () const |
virtual BaseRecordAttribute * | getCopy ()=0 |
virtual unsigned short | getDataFieldLength () const =0 |
virtual std::string | getDataReference () const |
EnDataType | getDataType () const |
std::string | getFieldName () const |
int | getFieldPos () |
std::streampos | getFilePosition () const |
virtual int | getFormattedFieldContents (std::string &rsRetVal, DATA_REFERENCE_INFO &rRetValInfo, ObjID ObjID) |
EnDataTypeGroup | getInfoType () |
unsigned int | getReferenceCount () const |
std::string | getTableFieldName () const |
std::string | getTableName () const |
ClassInfoAttribute::Type | getType () const |
std::string | getTypeAsCppString () const |
std::string | getTypeAsString () const |
std::string | getTypeInfo () const |
virtual std::string | getValueAsDataString () const =0 |
virtual std::string | getValueAsDisplayString () const =0 |
virtual std::string | getValueAsStreamString () const =0 |
virtual std::string | getValueAsString () const =0 |
virtual void * | getValueAsVoidPointer ()=0 |
virtual void | initNew ()=0 |
unsigned int | remember () |
virtual void | setDataReference (const std::string &rsDataReference) |
void | setFilePosition (const std::streampos &rFilePos) |
virtual int | setValueFromObjectAttributeID (Persistent &rObject, const AttributeID &rAttributeID) |
virtual void | setValueFromVoid (void *pValue)=0 |
virtual int | takeValue (const BaseRecordAttribute &rT) |
virtual int | updateDataReference (const std::string &rsDataPath, DATA_REFERENCE_INFO MethodInfo) |
bool | operator== (const BaseRecordAttribute &rT) const |
Comparison operator, all attributes are compared. | |
bool | operator!= (const BaseRecordAttribute &rT) const |
Comparison operator, all attributes are compared. | |
Protected Member Functions | |
BaseRecordAttribute () | |
BaseRecordAttribute (const BaseRecordAttribute &rT) | |
Private Member Functions | |
BaseRecordAttribute & | operator= (const BaseRecordAttribute &) |
Private Attributes | |
std::streampos | m_FilePosition |
eut::CriticalSection | m_LocalCriticalSection |
ClassInfoAttribute * | m_pClassInfoAttribut |
unsigned int | m_uiReferenceCount |
Static Private Attributes | |
static unsigned int | sm_uiInstanceCount |
Friends | |
class | ptl::TDVList< BaseRecordAttribute > |
Base class for the individual attributes of a Record.
Only certain attributes are supported by GlobalObjects as storable. Every supported attribute of a persistent class must be derived from this class.
Objects of this type have a reference counter and must not be removed from memory using the destructor.
Objects with reference counters may only be instantiated once. When passing to another instance, the reference counter is incremented using remember(). If the instance that now owns the object no longer needs it, the reference counter is decremented using forget().
If the reference counter runs to 0, the destructor is called.
|
protected |
The standard constructor is not available.
|
virtual |
The destructor is not available. The object may only be removed from memory using forget().
glo::BaseRecordAttribute::BaseRecordAttribute | ( | ClassInfoAttribute * | pClassInfoAttribut, |
const std::streampos & | rFilePos ) |
Constructor with parameter passing.
[in] | pClassInfoAttribut | A class information attribute is expected. |
[in] | rFilePos | The file position. |
eut::ErrorNException | An exception is thrown if an error occurs. |
|
protected |
|
pure virtual |
Returns true if the attribute data is stored as field content.
Returns false if attributes whose contents are not necessarily in a table column (because they may sometimes or even always be too large, and therefore a reference to a file is used as field content).
Implemented in glo::BlobRecordAttribute, glo::BoolRecordAttribute, glo::CharRecordAttribute, glo::DateTimeRecordAttribute, glo::DoubleRecordAttribute, glo::FloatRecordAttribute, glo::IDRecordAttribute, glo::IntRecordAttribute, glo::LongDoubleRecordAttribute, glo::LongLongRecordAttribute, glo::LongRecordAttribute, glo::LotRecordAttribute, glo::ShortRecordAttribute, glo::StringRecordAttribute, glo::UCharRecordAttribute, glo::UIntRecordAttribute, glo::ULongLongRecordAttribute, glo::ULongRecordAttribute, and glo::UShortRecordAttribute.
unsigned int glo::BaseRecordAttribute::forget | ( | ) |
An object of this class should always be delivered with a previous call to remember(). The supplied instance must then 'forget' the object again using this method.
eut::ErrorNException | An exception is thrown if the reference counter goes into minus. |
AttributeID glo::BaseRecordAttribute::getAttributeID | ( | ) | const |
Returns a unique attribute ID from m_pClassInfoAttribut.
|
virtual |
Inserts the string from getValueAsStreamString() at the end of the passed blob. Is for the DataStreamer.
[in,out] | rBlob | The passed blob to which the data is appended. |
Reimplemented in glo::BlobRecordAttribute, glo::LotRecordAttribute, and glo::StringRecordAttribute.
ClassInfoAttribute * glo::BaseRecordAttribute::getClassInfoAttribute | ( | ) | const |
Returns the own class information attribute.
std::string glo::BaseRecordAttribute::getClassMemberName | ( | ) | const |
Returns the attribute description with class name separated by a period. For example, "MyClass.m_MyAttributes".
std::string glo::BaseRecordAttribute::getClassName | ( | ) | const |
Returns the class name to which the attribute belongs.
|
pure virtual |
Returns a copy of the object. Sometimes a copy of an attribute is needed, e.g. if a deep-copied record (with copied attributes) is needed.
Implemented in glo::BlobRecordAttribute, glo::BoolRecordAttribute, glo::CharRecordAttribute, glo::DateTimeRecordAttribute, glo::DoubleListRecordAttribute, glo::DoubleRecordAttribute, glo::DoubleSetRecordAttribute, glo::DoubleVectorRecordAttribute, glo::EmbeddedRecordAttribute, glo::FloatRecordAttribute, glo::IntListRecordAttribute, glo::IntRecordAttribute, glo::IntSetRecordAttribute, glo::IntVectorRecordAttribute, glo::LongDoubleRecordAttribute, glo::LongLongRecordAttribute, glo::LongRecordAttribute, glo::ObjIDRecordAttribute, glo::OdRefListRecordAttribute, glo::OdRefRecordAttribute, glo::OdRefSetRecordAttribute, glo::PoRefListRecordAttribute, glo::PoRefRecordAttribute, glo::PoRefSetRecordAttribute, glo::ShortRecordAttribute, glo::StdShrdPoRefRecordAttribute, glo::StringListRecordAttribute, glo::StringRecordAttribute, glo::StringSetRecordAttribute, glo::StringVectorRecordAttribute, glo::UCharRecordAttribute, glo::UIntRecordAttribute, glo::ULongLongRecordAttribute, glo::ULongRecordAttribute, and glo::UShortRecordAttribute.
|
pure virtual |
Returns the field length of the attribute value in subclasses.
Implemented in glo::BlobRecordAttribute, glo::BoolRecordAttribute, glo::CharRecordAttribute, glo::DateTimeRecordAttribute, glo::DoubleRecordAttribute, glo::FloatRecordAttribute, glo::IDRecordAttribute, glo::IntRecordAttribute, glo::LongDoubleRecordAttribute, glo::LongLongRecordAttribute, glo::LongRecordAttribute, glo::LotRecordAttribute, glo::ShortRecordAttribute, glo::StringRecordAttribute, glo::UCharRecordAttribute, glo::UIntRecordAttribute, glo::ULongLongRecordAttribute, glo::ULongRecordAttribute, and glo::UShortRecordAttribute.
|
virtual |
Just delivers an empty string here.
This method must be overwritten for attributes whose contents are not necessarily to be placed in a table column (because they may sometimes or always be too large, and therefore a reference to a file is used as the field content).
This method should provide the file name in which the data is stored.
Reimplemented in glo::BlobRecordAttribute, glo::LotRecordAttribute, and glo::StringRecordAttribute.
EnDataType glo::BaseRecordAttribute::getDataType | ( | ) | const |
Returns the attribute type as Enum.
std::string glo::BaseRecordAttribute::getFieldName | ( | ) | const |
The table field description is returned.
int glo::BaseRecordAttribute::getFieldPos | ( | ) |
Returns the column position in the table (starts at 0).
std::streampos glo::BaseRecordAttribute::getFilePosition | ( | ) | const |
Returns the position in the table file.
|
virtual |
Returns its formatted table field here as well as getValueAsDataString (...)
If the record attribute can have a reference to the data, this method returns its formatted table field and an information whether an external file for the data of the record attribute should be rewritten, kept or deleted; must then be overwritten in corresponding subclasses.
[in,out] | rsRetVal | The table field as it should be written. |
[in,out] | rRetValInfo | The information how to handle an external file. |
[in] | ObjID | If a file name has to be created, the file name is formed from this object ID. Usually this is the object ID of the object whose attribute value is requested. |
Reimplemented in glo::BlobRecordAttribute, glo::LotRecordAttribute, and glo::StringRecordAttribute.
EnDataTypeGroup glo::BaseRecordAttribute::getInfoType | ( | ) |
Returns the group type of the supported attribute type.
unsigned int glo::BaseRecordAttribute::getReferenceCount | ( | ) | const |
Returns the number of referencing instances.
std::string glo::BaseRecordAttribute::getTableFieldName | ( | ) | const |
Returns the table and table field name separated by a period. For example, "TableName.FieldName".
std::string glo::BaseRecordAttribute::getTableName | ( | ) | const |
The table description is returned.
ClassInfoAttribute::Type glo::BaseRecordAttribute::getType | ( | ) | const |
Returns the type of the own class information attribute.
std::string glo::BaseRecordAttribute::getTypeAsCppString | ( | ) | const |
Returns the type of attribute supported by GlobalObjects as it appears in the header- and source-file.
std::string glo::BaseRecordAttribute::getTypeAsString | ( | ) | const |
Returns the type of attribute supported by GlobalObjects as it appears in the schema.
std::string glo::BaseRecordAttribute::getTypeInfo | ( | ) | const |
Returns an attribute type information like a number for a string length or an expression like dependent etc. Is always dependent on the attribute type.
|
pure virtual |
Returns the value in subclasses as a formatted data string with the correct length for the entry in the table file (if necessary, padded with blanks at the front or back).
Implemented in glo::BlobRecordAttribute, glo::BoolRecordAttribute, glo::CharRecordAttribute, glo::DateTimeRecordAttribute, glo::DoubleRecordAttribute, glo::FloatRecordAttribute, glo::IDRecordAttribute, glo::IntRecordAttribute, glo::LongDoubleRecordAttribute, glo::LongLongRecordAttribute, glo::LongRecordAttribute, glo::LotRecordAttribute, glo::ShortRecordAttribute, glo::StringRecordAttribute, glo::UCharRecordAttribute, glo::UIntRecordAttribute, glo::ULongLongRecordAttribute, glo::ULongRecordAttribute, and glo::UShortRecordAttribute.
|
pure virtual |
Returns the value in subclasses as it can be displayed for the GUI.
Implemented in glo::BlobRecordAttribute, glo::BoolRecordAttribute, glo::CharRecordAttribute, glo::DateTimeRecordAttribute, glo::DoubleRecordAttribute, glo::FloatRecordAttribute, glo::IDRecordAttribute, glo::IntRecordAttribute, glo::LongDoubleRecordAttribute, glo::LongLongRecordAttribute, glo::LongRecordAttribute, glo::LotRecordAttribute, glo::ShortRecordAttribute, glo::StringRecordAttribute, glo::UCharRecordAttribute, glo::UIntRecordAttribute, glo::ULongLongRecordAttribute, glo::ULongRecordAttribute, and glo::UShortRecordAttribute.
|
pure virtual |
Returns the value in subclasses as string for the DataStreamer.
Implemented in glo::BlobRecordAttribute, glo::BoolRecordAttribute, glo::CharRecordAttribute, glo::DateTimeRecordAttribute, glo::DoubleRecordAttribute, glo::FloatRecordAttribute, glo::IDRecordAttribute, glo::IntRecordAttribute, glo::LongDoubleRecordAttribute, glo::LongLongRecordAttribute, glo::LongRecordAttribute, glo::LotRecordAttribute, glo::OdRefListRecordAttribute, glo::OdRefSetRecordAttribute, glo::PoRefListRecordAttribute, glo::PoRefSetRecordAttribute, glo::ShortRecordAttribute, glo::StringRecordAttribute, glo::UCharRecordAttribute, glo::UIntRecordAttribute, glo::ULongLongRecordAttribute, glo::ULongRecordAttribute, and glo::UShortRecordAttribute.
|
pure virtual |
Returns the attribute value as a string in subclasses.
Implemented in glo::BlobRecordAttribute, glo::BoolRecordAttribute, glo::CharRecordAttribute, glo::DateTimeRecordAttribute, glo::DoubleRecordAttribute, glo::FloatRecordAttribute, glo::IDRecordAttribute, glo::IntRecordAttribute, glo::LongDoubleRecordAttribute, glo::LongLongRecordAttribute, glo::LongRecordAttribute, glo::LotRecordAttribute, glo::ShortRecordAttribute, glo::StringRecordAttribute, glo::UCharRecordAttribute, glo::UIntRecordAttribute, glo::ULongLongRecordAttribute, glo::ULongRecordAttribute, and glo::UShortRecordAttribute.
|
pure virtual |
Returns a raw pointer to the attribute value in subclasses.
Implemented in glo::BlobRecordAttribute, glo::BoolRecordAttribute, glo::CharRecordAttribute, glo::DateTimeRecordAttribute, glo::DoubleListRecordAttribute, glo::DoubleRecordAttribute, glo::DoubleSetRecordAttribute, glo::DoubleVectorRecordAttribute, glo::FloatRecordAttribute, glo::IDRecordAttribute, glo::IntListRecordAttribute, glo::IntRecordAttribute, glo::IntSetRecordAttribute, glo::IntVectorRecordAttribute, glo::LongDoubleRecordAttribute, glo::LongLongRecordAttribute, glo::LongRecordAttribute, glo::OdRefListRecordAttribute, glo::OdRefSetRecordAttribute, glo::PoRefListRecordAttribute, glo::PoRefSetRecordAttribute, glo::ShortRecordAttribute, glo::StringListRecordAttribute, glo::StringRecordAttribute, glo::StringSetRecordAttribute, glo::StringVectorRecordAttribute, glo::UCharRecordAttribute, glo::UIntRecordAttribute, glo::ULongLongRecordAttribute, glo::ULongRecordAttribute, and glo::UShortRecordAttribute.
|
pure virtual |
Initializes the attribute in the respective subclasses.
Implemented in glo::BlobRecordAttribute, glo::BoolRecordAttribute, glo::CharRecordAttribute, glo::DateTimeRecordAttribute, glo::DoubleRecordAttribute, glo::FloatRecordAttribute, glo::IDRecordAttribute, glo::IntRecordAttribute, glo::LongDoubleRecordAttribute, glo::LongLongRecordAttribute, glo::LongRecordAttribute, glo::LotRecordAttribute, glo::ShortRecordAttribute, glo::StringRecordAttribute, glo::UCharRecordAttribute, glo::UIntRecordAttribute, glo::ULongLongRecordAttribute, glo::ULongRecordAttribute, and glo::UShortRecordAttribute.
bool glo::BaseRecordAttribute::operator!= | ( | const BaseRecordAttribute & | rT | ) | const |
Comparison operator, all attributes are compared.
[in] | rT | The object to be compared with this one. |
|
private |
The assignment operator is not available.
bool glo::BaseRecordAttribute::operator== | ( | const BaseRecordAttribute & | rT | ) | const |
Comparison operator, all attributes are compared.
[in] | rT | The object to be compared with this one. |
unsigned int glo::BaseRecordAttribute::remember | ( | ) |
Increments the m_uiReferenceCount. Should always be called when an object of this class is delivered. The delivered instance must then 'forget' the object with forget().
|
virtual |
Not doing anything here.
This method must be overwritten for attributes whose contents are not necessarily to be placed in a table column (because they may sometimes or always be too large, and therefore a reference to a file is used as the field content).
This method should set the file name in which the data is stored.
[in] | rsDataReference | The file name. |
Reimplemented in glo::BlobRecordAttribute, and glo::StringRecordAttribute.
void glo::BaseRecordAttribute::setFilePosition | ( | const std::streampos & | rFilePos | ) |
Sets the position in the table file.
[in] | rFilePos | The file position. |
|
virtual |
The value of the RecordAttribut is determined from the class attribute of the passed Persistent using the passed AttributeID and usually the value is set using setValueFromVoid (...).
In subclasses, this method should be overwritten if the attribute is still to be fetched. See for example EmbeddedRecordAttribute::setValueFromObjectAttributeID (...).
[in] | rObject | The persistent object whose attribute is used. |
[in] | rAttributeID | The ID of the attribute of the passed object. |
eut::ErrorNException | In case of an error, an exception can be thrown in subclasses. |
Reimplemented in glo::EmbeddedRecordAttribute, glo::ObjIDRecordAttribute, glo::OdRefListRecordAttribute, glo::OdRefRecordAttribute, glo::OdRefSetRecordAttribute, glo::PoRefListRecordAttribute, glo::PoRefRecordAttribute, glo::PoRefSetRecordAttribute, and glo::StdShrdPoRefRecordAttribute.
|
pure virtual |
Transfers the value which is passed as a raw pointer to subclasses. A static_cast is made in each case.
[in] | pValue | The value as raw pointer. |
Implemented in glo::APointerRecordAttribute, glo::BlobRecordAttribute, glo::BoolRecordAttribute, glo::CharRecordAttribute, glo::DateTimeRecordAttribute, glo::DoubleRecordAttribute, glo::FloatRecordAttribute, glo::IDRecordAttribute, glo::IntRecordAttribute, glo::LongDoubleRecordAttribute, glo::LongLongRecordAttribute, glo::LongRecordAttribute, glo::ShortRecordAttribute, glo::StringRecordAttribute, glo::UCharRecordAttribute, glo::UIntRecordAttribute, glo::ULongLongRecordAttribute, glo::ULongRecordAttribute, glo::UShortRecordAttribute, glo::DoubleListRecordAttribute, glo::IntListRecordAttribute, glo::OdRefListRecordAttribute, glo::PoRefListRecordAttribute, glo::StringListRecordAttribute, glo::DoubleSetRecordAttribute, glo::IntSetRecordAttribute, glo::OdRefSetRecordAttribute, glo::PoRefSetRecordAttribute, glo::StringSetRecordAttribute, glo::DoubleVectorRecordAttribute, glo::IntVectorRecordAttribute, and glo::StringVectorRecordAttribute.
|
virtual |
In this method the file position is taken over from rT. In subclasses, the attribute value is taken from the attribute passed, if possible. It is tried to cast the value somehow.
[in] | rT | The persistent attribute from which the values are to be taken. |
Reimplemented in glo::BlobRecordAttribute, glo::BoolRecordAttribute, glo::CharRecordAttribute, glo::DateTimeRecordAttribute, glo::DoubleListRecordAttribute, glo::DoubleLotRecordAttribute, glo::DoubleRecordAttribute, glo::DoubleSetRecordAttribute, glo::DoubleVectorRecordAttribute, glo::FloatRecordAttribute, glo::IDRecordAttribute, glo::IntListRecordAttribute, glo::IntLotRecordAttribute, glo::IntRecordAttribute, glo::IntSetRecordAttribute, glo::IntVectorRecordAttribute, glo::LongDoubleRecordAttribute, glo::LongLongRecordAttribute, glo::LongRecordAttribute, glo::OdRefListRecordAttribute, glo::OdRefSetRecordAttribute, glo::PoRefListRecordAttribute, glo::PoRefSetRecordAttribute, glo::ShortRecordAttribute, glo::StringListRecordAttribute, glo::StringLotRecordAttribute, glo::StringRecordAttribute, glo::StringSetRecordAttribute, glo::StringVectorRecordAttribute, glo::TypeLotRecordAttribute, glo::UCharRecordAttribute, glo::UIntRecordAttribute, glo::ULongLongRecordAttribute, glo::ULongRecordAttribute, and glo::UShortRecordAttribute.
|
virtual |
Not doing anything here.
This method must be overwritten for attributes whose contents are not necessarily to be placed in a table column (because they may sometimes or always be too large, and therefore a reference to a file is used as the field content).
This method should delete or write the file with the data if necessary.
[in] | rsDataPath | The full directory name where the data can be found. The data is always located in a subdirectory of the directory where the schema file is located (e.g. "C:/Path/Data/"). |
[in] | MethodInfo | The information how to handle an external file. |
Reimplemented in glo::BlobRecordAttribute, glo::LotRecordAttribute, and glo::StringRecordAttribute.
|
friend |
|
private |
Each persistent attribute, when saved, has a unique file location
|
private |
So that several threads can access remember() and forget(), access is synchronized with this object.
|
private |
Each persistent attribute needs specific schema information. These are available in the schema in the respective class information (ClassInfo) as class information attributes (GloClassInfoAttributes).
|
private |
The reference counter.
|
staticprivate |
For debug purposes, a static reference counter to check if all instances are cleared.