GlobalObjects
Loading...
Searching...
No Matches
glo::BlobRecordAttribute Class Reference

Class for the blob attributes of a Record. More...

#include <GloBlobRecordAttribute.h>

Inheritance diagram for glo::BlobRecordAttribute:

Public Member Functions

 BlobRecordAttribute (ClassInfoAttribute *pType, const eut::Blob &rValue, const std::streampos &rFilePos)
 
 BlobRecordAttribute (ClassInfoAttribute *pType, const std::streampos &rFilePos)
 
virtual bool dataIsFieldContent () const
 
virtual int getAttributeValueBlob (eut::Blob &rBlob) const
 
virtual BaseRecordAttributegetCopy ()
 
virtual unsigned short getDataFieldLength () const
 
virtual std::string getDataReference () const
 
const std::string & getFileName () const
 
virtual int getFormattedFieldContents (std::string &rsRetVal, DATA_REFERENCE_INFO &rRetValInfo, ObjID ObjID)
 
virtual std::string getValueAsDataString () const
 
virtual std::string getValueAsDisplayString () const
 
virtual std::string getValueAsStreamString () const
 
virtual std::string getValueAsString () const
 
virtual void * getValueAsVoidPointer ()
 
const eut::BlobgetValueRef () const
 
virtual void initNew ()
 
virtual void setDataReference (const std::string &rsDataReference)
 
void setDeterminedFileNameFromAttributeValue (ObjID ObjID)
 
void setFileName (const std::string &rsFileName)
 
int setValue (char *pData, std::size_t nDataSize, bool bCopy=true)
 
void setValue (const eut::Blob &rValue)
 
virtual void setValueFromVoid (void *pValue)
 
virtual int takeValue (const BaseRecordAttribute &rT)
 
virtual int updateDataReference (const std::string &rsDataPath, DATA_REFERENCE_INFO MethodInfo)
 
bool operator== (const BlobRecordAttribute &rT) const
 
bool operator!= (const BlobRecordAttribute &rT) const
 
- Public Member Functions inherited from glo::BaseRecordAttribute
 BaseRecordAttribute (ClassInfoAttribute *pClassInfoAttribut, const std::streampos &rFilePos)
 
virtual ~BaseRecordAttribute ()
 
unsigned int forget ()
 
AttributeID getAttributeID () const
 
ClassInfoAttributegetClassInfoAttribute () const
 
std::string getClassMemberName () const
 
std::string getClassName () const
 
EnDataType getDataType () const
 
std::string getFieldName () const
 
int getFieldPos ()
 
std::streampos getFilePosition () const
 
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
 
unsigned int remember ()
 
void setFilePosition (const std::streampos &rFilePos)
 
virtual int setValueFromObjectAttributeID (Persistent &rObject, const AttributeID &rAttributeID)
 
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

 BlobRecordAttribute ()
 
 BlobRecordAttribute (const BlobRecordAttribute &rT)
 
virtual ~BlobRecordAttribute ()
 
- Protected Member Functions inherited from glo::BaseRecordAttribute
 BaseRecordAttribute ()
 
 BaseRecordAttribute (const BaseRecordAttribute &rT)
 

Private Member Functions

BlobRecordAttributeoperator= (const BlobRecordAttribute &)
 

Private Attributes

std::string m_sFileName
 
eut::Blob m_Value
 

Detailed Description

Class for the blob attributes of a Record.

Represents an attribute of the type 'eut::Blob' of a persistent object.

Author
Helmut Jakoby

Constructor & Destructor Documentation

◆ BlobRecordAttribute() [1/4]

glo::BlobRecordAttribute::BlobRecordAttribute ( )
protected

The standard constructor is not available.

◆ ~BlobRecordAttribute()

virtual glo::BlobRecordAttribute::~BlobRecordAttribute ( )
protectedvirtual

The destructor is not available. The object may only be removed from memory using forget().

◆ BlobRecordAttribute() [2/4]

glo::BlobRecordAttribute::BlobRecordAttribute ( ClassInfoAttribute * pType,
const std::streampos & rFilePos )

Constructor with parameter passing.

Parameters
[in]pTypeA class information attribute is expected.
[in]rFilePosThe file position.
Exceptions
eut::ErrorNExceptionAn exception will be thrown if an error occurs.
Attention
Since objects of these classes are only instantiated by internal objects like Record and TableReaderInterface, and they know what they are doing, a type check of the class information attribute is omitted!

◆ BlobRecordAttribute() [3/4]

glo::BlobRecordAttribute::BlobRecordAttribute ( ClassInfoAttribute * pType,
const eut::Blob & rValue,
const std::streampos & rFilePos )

Constructor with parameter passing.

Parameters
[in]pTypeA class information attribute is expected.
[in]rValueThe value of the attribute.
[in]rFilePosThe file position.
Exceptions
eut::ErrorNExceptionAn exception will be thrown if an error occurs.
Attention
Since objects of these classes are only instantiated by internal objects like Record and TableReaderInterface, and they know what they are doing, a type check of the class information attribute is omitted!

◆ BlobRecordAttribute() [4/4]

glo::BlobRecordAttribute::BlobRecordAttribute ( const BlobRecordAttribute & rT)
protected

Copy constructor.

Parameters
[in]rTThe data is copied from this object.
See also
getCopy()

Member Function Documentation

◆ dataIsFieldContent()

virtual bool glo::BlobRecordAttribute::dataIsFieldContent ( ) const
virtual

Returns false, since attribute data of a blob is always stored outside the table. The file name of the file containing the blob data is stored in the table.

Returns
see above

Implements glo::BaseRecordAttribute.

◆ getAttributeValueBlob()

virtual int glo::BlobRecordAttribute::getAttributeValueBlob ( eut::Blob & rBlob) const
virtual

Returns only one mistake here! The DataStreamer retrieves the data via the file name.

Returns
Always returns ERR_METHOD_FORBIDDEN.

Reimplemented from glo::BaseRecordAttribute.

◆ getCopy()

virtual BaseRecordAttribute * glo::BlobRecordAttribute::getCopy ( )
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.

Returns
The copy of this attribute
Attention
The supplied object must be removed from memory by the calling instance.

Implements glo::BaseRecordAttribute.

◆ getDataFieldLength()

virtual unsigned short glo::BlobRecordAttribute::getDataFieldLength ( ) const
virtual

Returns the record field length of the attribute value. In this case it is always the length of the file name of the file in which the blob is to be stored.

Returns
The field length.
See also
BLOB_TEXT_LENGTH

Implements glo::BaseRecordAttribute.

◆ getDataReference()

virtual std::string glo::BlobRecordAttribute::getDataReference ( ) const
virtual

Returns the file name in which the blob data is stored.

Returns
The existing file name if necessary. If empty, then there is probably none.
Note
The file name is delivered with complete path.

Reimplemented from glo::BaseRecordAttribute.

◆ getFileName()

const std::string & glo::BlobRecordAttribute::getFileName ( ) const

Returns the name of the file in which the blob should be placed.

Returns
The file name.
Note
The file name is delivered without path and without file extension.

◆ getFormattedFieldContents()

virtual int glo::BlobRecordAttribute::getFormattedFieldContents ( std::string & rsRetVal,
DATA_REFERENCE_INFO & rRetValInfo,
ObjID ObjID )
virtual

Provides the name of the external file with the attribute's data and a information whether it needs to be rewritten, kept or deleted if there is content to be saved. The name of the external file is also set in the m_sFileName attribute.

Parameters
[in,out]rsRetValThe table field as it should be written.
[in,out]rRetValInfoThe information how to handle an external file.
[in]ObjIDIf 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.
Returns
A return value < 0 indicates an error.

Reimplemented from glo::BaseRecordAttribute.

◆ getValueAsDataString()

virtual std::string glo::BlobRecordAttribute::getValueAsDataString ( ) const
virtual

Cannot return the value as string, returns "?" instead.

Returns
"?".

Implements glo::BaseRecordAttribute.

◆ getValueAsDisplayString()

virtual std::string glo::BlobRecordAttribute::getValueAsDisplayString ( ) const
virtual

Returns the value as it can be displayed for the GUI.

Returns
The value for the display.

Implements glo::BaseRecordAttribute.

◆ getValueAsStreamString()

virtual std::string glo::BlobRecordAttribute::getValueAsStreamString ( ) const
virtual

Cannot return the value as string, returns "?" instead.

Returns
"?".

Implements glo::BaseRecordAttribute.

◆ getValueAsString()

virtual std::string glo::BlobRecordAttribute::getValueAsString ( ) const
virtual

Cannot return the value as string, returns "?" instead.

Returns
"?".

Implements glo::BaseRecordAttribute.

◆ getValueAsVoidPointer()

virtual void * glo::BlobRecordAttribute::getValueAsVoidPointer ( )
virtual

Returns a raw pointer to the value.

Returns
The raw pointer to the value.

Implements glo::BaseRecordAttribute.

◆ getValueRef()

const eut::Blob & glo::BlobRecordAttribute::getValueRef ( ) const

Returns the reference to the value.

Returns
The value.

◆ initNew()

virtual void glo::BlobRecordAttribute::initNew ( )
virtual

Reinitializes the attribute, the value is set to NULL_PTR.

Implements glo::BaseRecordAttribute.

◆ operator!=()

bool glo::BlobRecordAttribute::operator!= ( const BlobRecordAttribute & rT) const

Comparison operator, all attributes are compared.

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

◆ operator=()

BlobRecordAttribute & glo::BlobRecordAttribute::operator= ( const BlobRecordAttribute & )
private

The assignment operator is not available.

◆ operator==()

bool glo::BlobRecordAttribute::operator== ( const BlobRecordAttribute & rT) const

Comparison operator, all attributes are compared.

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

◆ setDataReference()

virtual void glo::BlobRecordAttribute::setDataReference ( const std::string & rsDataReference)
virtual

Sets the name of the file in which the blob is to be saved.

Parameters
[in]rsDataReferenceThe file name.
Note
The file name is passed without path and without file extension.

Reimplemented from glo::BaseRecordAttribute.

◆ setDeterminedFileNameFromAttributeValue()

void glo::BlobRecordAttribute::setDeterminedFileNameFromAttributeValue ( ObjID ObjID)

Sets the identified designation of the file in which the blob is to be accommodated if there is something to save.

Parameters
[in]ObjIDIf 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.

◆ setFileName()

void glo::BlobRecordAttribute::setFileName ( const std::string & rsFileName)

Sets the name of the file in which the blob should be placed.

Parameters
[in]rsFileNameThe file name.
Note
The file name is passed without path and without file extension.

◆ setValue() [1/2]

int glo::BlobRecordAttribute::setValue ( char * pData,
std::size_t nDataSize,
bool bCopy = true )

Sets the value of the attribute.

Parameters
[in]pDataA pointer to an allocated memory.
[in]nDataSizeThe size of pData.
[in]bCopyIf false, pData is not copied, only the raw pointer is set.
Returns
A return <0 indicates an error.

◆ setValue() [2/2]

void glo::BlobRecordAttribute::setValue ( const eut::Blob & rValue)

Sets the value of the attribute.

Parameters
[in]rValueThe new value.

◆ setValueFromVoid()

virtual void glo::BlobRecordAttribute::setValueFromVoid ( void * pValue)
virtual

Sets the value of the attribute. Is assigned via a static_cast.

Parameters
[in]pValueThe raw pointer to the value.

Implements glo::BaseRecordAttribute.

◆ takeValue()

virtual int glo::BlobRecordAttribute::takeValue ( const BaseRecordAttribute & rT)
virtual

Adopts the value from transferred attribute, if possible. An attempt is made to cast the value in some way.

Parameters
[in]rTThe persistent attribute from which the values are to be taken.
Returns
An error respectively warning message from subclasses will be delivered if the cast does not work.

Reimplemented from glo::BaseRecordAttribute.

◆ updateDataReference()

virtual int glo::BlobRecordAttribute::updateDataReference ( const std::string & rsDataPath,
DATA_REFERENCE_INFO MethodInfo )
virtual

Deletes respectively writes an external file with the blob data.

Parameters
[in]rsDataPathThe 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]MethodInfoThe information how to handle an external file.
Returns
A return value < 0 indicates an error.

Reimplemented from glo::BaseRecordAttribute.

Member Data Documentation

◆ m_sFileName

std::string glo::BlobRecordAttribute::m_sFileName
private

A blob is always stored in a file with this name.

◆ m_Value

eut::Blob glo::BlobRecordAttribute::m_Value
private

The value of the attribute.


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