faudes::TypeDefinition Class Reference
|
Public Member Functions | |
TypeDefinition (const std::string &name="") | |
Constructor. | |
virtual | ~TypeDefinition (void) |
Destructor. | |
const Type * | Prototype (void) const |
Return pointer to faudes-object prototype. | |
Type * | NewObject (void) const |
Construct faudes-object on heap. | |
const std::string & | XElementTag (void) const |
Parameter access: Xml Element Tag. | |
void | XElementTag (const std::string &rTag) |
Parameter access: Xml Element Tag. | |
Static Public Member Functions | |
template<class T > | |
static TypeDefinition * | Constructor (const std::string &rTypeName="") |
Construct empty TypeDefinition object. | |
static TypeDefinition * | Constructor (Type *pProto, const std::string &rTypeName="") |
Construct empty TypeDefinition object. | |
template<class T > | |
static TypeDefinition * | FromFile (const std::string &rFileName) |
Construct TypeDefinition object and read name and documentation-data from TokenReader. | |
Protected Member Functions | |
virtual void | DoAssign (const TypeDefinition &rSrc) |
Std faudes type interface: assignment. | |
virtual bool | DoEqual (const TypeDefinition &rOther) const |
Std faudes type interface: test equality. | |
TypeDefinition (const TypeDefinition &rOther) | |
Disable copy constructor. | |
void | Clear (void) |
Clear documentation-data; do *NOT* delete prototype (this is for using Read to merge/overwrite documentation). | |
virtual void | Prototype (Type *pType) |
Use given object as prototype. | |
virtual void | DoRead (TokenReader &rTr, const std::string &rLabel="", const Type *pContext=0) |
Read configuration data of this object from TokenReader. | |
virtual void | DoReadCore (TokenReader &rTr) |
Read configuration data of this object from TokenReader. | |
virtual void | DoWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const |
Write configuration data of this object to TokenWriter. | |
virtual void | DoWriteCore (TokenWriter &rTw) const |
Write configuration data of this object to TokenWriter. | |
Protected Attributes | |
Type * | mpType |
Type-pointer tp prototype instance. | |
std::string | mXElementTag |
Extra documentation/parameter: Xml Element Tag. | |
Friends | |
class | TypeRegistry |
A TypeDefinition defines a faudes-type in that it specifies a faudes-type name to identify the type and a method NewObject() to instantiate objects of the respective type.
In this sense, TypeDefinition is a so called factory class. Technically, the TypeDefinition holds one instance of the faude type, the so called prototype object, and NewObject() invokes the New() method of the prototype. Notebly, there is only one class TypeDefinition that by parametrisation defins all derivates of Type.
TypeDefinition is derived from faudes::Documentation and therefore additional documentation-data can be associated.
Definition at line 1396 of file cfl_types.h.
faudes::TypeDefinition::TypeDefinition | ( | const std::string & | name = "" |
) | [inline] |
Constructor.
The default constructor instantiates an invalid type definition without prototype. To construct a valid type definition, use the static Constructor() template function.
Definition at line 1414 of file cfl_types.h.
virtual faudes::TypeDefinition::~TypeDefinition | ( | void | ) | [inline, virtual] |
faudes::TypeDefinition::TypeDefinition | ( | const TypeDefinition & | rOther | ) | [inline, protected] |
Disable copy constructor.
Definition at line 1542 of file cfl_types.h.
void faudes::TypeDefinition::Clear | ( | void | ) | [protected, virtual] |
Clear documentation-data; do *NOT* delete prototype (this is for using Read to merge/overwrite documentation).
Reimplemented from faudes::Documentation.
Definition at line 725 of file cfl_types.cpp.
TypeDefinition * faudes::TypeDefinition::Constructor | ( | Type * | pProto, | |
const std::string & | rTypeName = "" | |||
) | [static] |
Construct empty TypeDefinition object.
The given prototype is assigned to the member variable pType,
pProto | Prototype, derived from Type | |
rTypeName | Name to identify this faudes-type<; defaults to the plattform dependand typeid from the c++ runtime type information system. |
Definition at line 713 of file cfl_types.cpp.
TypeDefinition * faudes::TypeDefinition::Constructor | ( | const std::string & | rTypeName = "" |
) | [inline, static] |
Construct empty TypeDefinition object.
The given template parameter denotes any libFAUDES class derived from faudes::Type A new instance of this class is assigned to member variable (pType) whereas the name is set as specified.
T | Actual c class, derived from Type |
rTypeName | Name to identify this faudes-type<; defaults to the plattform dependand typeid from the c++ runtime type information system. |
Definition at line 1650 of file cfl_types.h.
void faudes::TypeDefinition::DoAssign | ( | const TypeDefinition & | rSrc | ) | [protected, virtual] |
Std faudes type interface: assignment.
rSrc | Source to copy from |
Definition at line 735 of file cfl_types.cpp.
bool faudes::TypeDefinition::DoEqual | ( | const TypeDefinition & | rOther | ) | const [protected, virtual] |
Std faudes type interface: test equality.
rOther | Other object to compare with. |
Definition at line 748 of file cfl_types.cpp.
void faudes::TypeDefinition::DoRead | ( | TokenReader & | rTr, | |
const std::string & | rLabel = "" , |
|||
const Type * | pContext = 0 | |||
) | [protected, virtual] |
Read configuration data of this object from TokenReader.
The section defaults to "TypeDefinition", context ignored. Actual reading is done by DoReadCore.
rTr | TokenReader to read from | |
rLabel | Section to read | |
pContext | Read context to provide contextual information (ignored) |
Reimplemented from faudes::Documentation.
Definition at line 758 of file cfl_types.cpp.
void faudes::TypeDefinition::DoReadCore | ( | TokenReader & | rTr | ) | [protected, virtual] |
Read configuration data of this object from TokenReader.
This method reads members only, it does not read the section.
rTr | TokenReader to read from |
Reimplemented from faudes::Documentation.
Definition at line 771 of file cfl_types.cpp.
void faudes::TypeDefinition::DoWrite | ( | TokenWriter & | rTw, | |
const std::string & | rLabel = "" , |
|||
const Type * | pContext = 0 | |||
) | const [protected, virtual] |
Write configuration data of this object to TokenWriter.
The section defaults to "TypeDefinition", context ignored. Actual writing is done by DoWriteCore.
rTw | Reference to TokenWriter | |
rLabel | Label of section to write | |
pContext | Write context to provide contextual information |
Exception |
|
Reimplemented from faudes::Documentation.
Definition at line 794 of file cfl_types.cpp.
void faudes::TypeDefinition::DoWriteCore | ( | TokenWriter & | rTw | ) | const [protected, virtual] |
Write configuration data of this object to TokenWriter.
This method wrtite plain member data, the section lables are not written.
rTw | Reference to TokenWriter |
Exception |
|
Reimplemented from faudes::Documentation.
Definition at line 803 of file cfl_types.cpp.
TypeDefinition * faudes::TypeDefinition::FromFile | ( | const std::string & | rFileName | ) | [inline, static] |
Construct TypeDefinition object and read name and documentation-data from TokenReader.
T | Actual c class, derived from Type |
rFileName | Name of file to read. |
Definition at line 1658 of file cfl_types.h.
Type * faudes::TypeDefinition::NewObject | ( | void | ) | const |
Construct faudes-object on heap.
Return pointer to new instance of assigned Type class.
Note: If no prototype is installed, NULL is returned.
Definition at line 839 of file cfl_types.cpp.
void faudes::TypeDefinition::Prototype | ( | faudes::Type * | pType | ) | [protected, virtual] |
Use given object as prototype.
The TypeDefinition takes ownership of the provided object.
pType | Any class that inherits Type. |
Definition at line 823 of file cfl_types.cpp.
const Type * faudes::TypeDefinition::Prototype | ( | void | ) | const |
Return pointer to faudes-object prototype.
Note: this method is meant for inspection only, control over the prototype remains with the TypeDefinition. Use NewObject() to instantiate a new faudes-object.
Definition at line 818 of file cfl_types.cpp.
void faudes::TypeDefinition::XElementTag | ( | const std::string & | rTag | ) |
Parameter access: Xml Element Tag.
rTag | New tag parameter |
Definition at line 855 of file cfl_types.cpp.
const std::string & faudes::TypeDefinition::XElementTag | ( | void | ) | const |
Parameter access: Xml Element Tag.
This parameter is used for Xml IO of sets and vectors. It determines the tag to used for individual elments.
Definition at line 850 of file cfl_types.cpp.
friend class TypeRegistry [friend] |
Definition at line 1402 of file cfl_types.h.
Type* faudes::TypeDefinition::mpType [protected] |
Type-pointer tp prototype instance.
Definition at line 1627 of file cfl_types.h.
std::string faudes::TypeDefinition::mXElementTag [protected] |
Extra documentation/parameter: Xml Element Tag.
Definition at line 1630 of file cfl_types.h.
libFAUDES 2.23h --- 2014.04.03 --- c++ api documentaion by doxygen