This class can instantiate a persistent object from a record or fill a persistent object and vice versa.
More...
#include <GloObjectMaker.h>
This class can instantiate a persistent object from a record or fill a persistent object and vice versa.
- Copyright
- © 2010 Helmut Jakoby
- Author
- Helmut Jakoby
◆ ObjectMaker() [1/3]
glo::ObjectMaker::ObjectMaker |
( |
| ) |
|
|
private |
The standard constructor is not available.
◆ ObjectMaker() [2/3]
glo::ObjectMaker::ObjectMaker |
( |
const std::string & | rstrSchemaNameWithPath, |
|
|
ObjCreator & | rCreator ) |
Constructor with parameter passing.
- Parameters
-
[in] | rstrSchemaNameWithPath | File name of the schema with path; e.g. "C:/Path/MyGloBase.ini". |
[in] | rCreator | The derived ObjCreator, this is copied. |
- Exceptions
-
eut::ErrorNException | In case of an error an exception will be thrown (e.g. if the schema file does not exist or cannot be opened). |
- Attention
- If the schema file with the given name exists, a SchemaInterface is instantiated.
◆ ~ObjectMaker()
virtual glo::ObjectMaker::~ObjectMaker |
( |
| ) |
|
|
virtual |
◆ ObjectMaker() [3/3]
The copy constructor is not available.
◆ fillPersObject()
Fills the passed persistent object with the data of the passed record from the passed database.
- Parameters
-
[in,out] | rObject | The persistent object to be filled with data. |
[in] | rRecord | The record with the data from the database. |
[in] | pBase | The database in which the persistent object is stored. Is needed to reload possibly further, necessary data. |
- Returns
- A return value < 0 indicates an error.
- Note
- For Glo developers: Is implemented in GloRecordAttributeFunctions.cpp, so that extensions of data set attributes can be made there collectively.
◆ fillRecord()
int glo::ObjectMaker::fillRecord |
( |
Record & | rRecord, |
|
|
Persistent & | rObject, |
|
|
bool | bWithRefRecords = false ) const |
Fills the passed record with the data of the passed persistent object.
- Parameters
-
[in,out] | rRecord | The record to be filled with data. |
[in] | rObject | The persistent object with its data. |
[in] | bWithRefRecords | If true, for attributes of type PoRefRecordAttribute, StdShrdPoRefRecordAttribute, StdUnqPoRefRecordAttribute, PoRefListRecordAttribute and PoRefSetRecordAttribute, if they referenced to valid objects, the respective record will be generated.
This can be switched on or off, because the records of the referenced objects, if they are to be stored along, for example, are already generated via PrivateBase::getDependDataRecords (...).
Default is 'false'. |
- Returns
- A return value < 0 indicates an error.
◆ getClassID()
unsigned long glo::ObjectMaker::getClassID |
( |
BaseAllSet * | pAllSet | ) |
const |
Returns the class ID of the passed AllSet.
- Returns
- If known to AllSet then the corresponding class ID.
- Exceptions
-
◆ getSchema()
Returns its SchemaInterface.
- Returns
- The returned object lives only as long as this object and must not be removed from memory by the calling instance.
◆ isKnownClassID()
bool glo::ObjectMaker::isKnownClassID |
( |
unsigned long | ulClassID | ) |
const |
Asks the m_pObjCreator if the passed class ID is valid for it.
- Parameters
-
[in] | ulClassID | The class ID to check. |
- Returns
- If true, the ObjectCreator can instantiate an object of the persistent class with the given class ID.
◆ makeNewPersObject()
int glo::ObjectMaker::makeNewPersObject |
( |
Persistent *& | prNewObject, |
|
|
Record & | rRecord, |
|
|
Base * | pBase ) const |
Returns a new persistent object with the data of the passed record from the passed database.
- Parameters
-
[in,out] | prNewObject | This pointer returns the persistent object. |
[in] | rRecord | The record with the data from the database. |
[in] | pBase | The database in which the persistent object is stored. Is needed to reload possibly further, necessary data. |
- Returns
- A return value < 0 indicates an error.
- Attention
- If a new object has been delivered (not a possibly already existing one in memory is delivered), the record has been transferred to the new object and the database has been set in the new object.
- Exceptions
-
◆ makeNewRecord() [1/2]
int glo::ObjectMaker::makeNewRecord |
( |
Record *& | prNewRecord, |
|
|
Persistent & | rObject ) const |
Returns a new record (without data) which matches the given persistent object.
- Parameters
-
[in,out] | prNewRecord | The new record. |
[in] | rObject | The object for which the record is to be generated. |
- Returns
- A return value < 0 indicates an error.
◆ makeNewRecord() [2/2]
int glo::ObjectMaker::makeNewRecord |
( |
Record *& | prNewRecord, |
|
|
unsigned long | ulClassID ) const |
Returns a new record (without data) which matches a persistent object with a given class ID.
- Parameters
-
[in,out] | prNewRecord | The new record. |
[in] | ulClassID | The class ID for which the record should be generated. |
- Returns
- A return value < 0 indicates an error.
◆ operator=()
The assignment operator is not available.
◆ m_pObjCreator
The ObejectCreator, resp. its subclass, knows how to instantiate persistent objects.
◆ m_pSchema
To be able to generate and fill objects from records and to generate and fill records from these objects, the schema must be known.
The documentation for this class was generated from the following file: