faudes::TypeDefinition Class Reference
[Run-Time Interface]

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. More...

#include <cfl_types.h>

List of all members.

Public Member Functions

 TypeDefinition (const std::string &name="")
 Constructor.
virtual ~TypeDefinition (void)
 Destructor.
const TypePrototype (void) const
 Return pointer to faudes-object prototype.
TypeNewObject (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 TypeDefinitionConstructor (const std::string &rTypeName="")
 Construct empty TypeDefinition object.
static TypeDefinitionConstructor (Type *pProto, const std::string &rTypeName="")
 Construct empty TypeDefinition object.
template<class T >
static TypeDefinitionFromFile (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

TypempType
 Type-pointer tp prototype instance.
std::string mXElementTag
 Extra documentation/parameter: Xml Element Tag.

Friends

class TypeRegistry

Detailed Description

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.


Constructor & Destructor Documentation

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]

Destructor.

Delete prototype object.

Definition at line 1421 of file cfl_types.h.

faudes::TypeDefinition::TypeDefinition ( const TypeDefinition rOther  )  [inline, protected]

Disable copy constructor.

Definition at line 1542 of file cfl_types.h.


Member Function Documentation

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,

Parameters:
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.
Returns:
Newly constructed type definition.

Definition at line 713 of file cfl_types.cpp.

template<class T >
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.

Template Parameters:
T Actual c class, derived from Type
Parameters:
rTypeName Name to identify this faudes-type<; defaults to the plattform dependand typeid from the c++ runtime type information system.
Returns:
Newly constructed type definition.

Definition at line 1650 of file cfl_types.h.

void faudes::TypeDefinition::DoAssign ( const TypeDefinition rSrc  )  [protected, virtual]

Std faudes type interface: assignment.

Parameters:
rSrc Source to copy from
Returns:
Reference to this object.

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.

Parameters:
rOther Other object to compare with.
Returns:
True on match.

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.

Parameters:
rTr TokenReader to read from
rLabel Section to read
pContext Read context to provide contextual information (ignored)
Exceptions:
Exception 
  • Token mismatch (id 50, 51, 52)
  • IO error (id 1)

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.

Parameters:
rTr TokenReader to read from
Exceptions:
Exception 
  • Token mismatch (id 50, 51, 52)
  • IO error (id 1)

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.

Parameters:
rTw Reference to TokenWriter
rLabel Label of section to write
pContext Write context to provide contextual information
Exceptions:
Exception 
  • IO errors (id 2)

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.

Parameters:
rTw Reference to TokenWriter
Exceptions:
Exception 
  • IO errors (id 2)

Reimplemented from faudes::Documentation.

Definition at line 803 of file cfl_types.cpp.

template<class T >
TypeDefinition * faudes::TypeDefinition::FromFile ( const std::string &  rFileName  )  [inline, static]

Construct TypeDefinition object and read name and documentation-data from TokenReader.

Template Parameters:
T Actual c class, derived from Type
Parameters:
rFileName Name of file to read.
Returns:
Newly constructed type definition.
Exceptions:
Exception 
  • Token mismatch (id 50, 51, 52)
  • IO Error (id 1)

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.

Returns:
Pointer to new Type instance.

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.

Parameters:
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.

Returns:
Reference to prototype object

Definition at line 818 of file cfl_types.cpp.

void faudes::TypeDefinition::XElementTag ( const std::string &  rTag  ) 

Parameter access: Xml Element Tag.

Parameters:
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.

Returns:
Tag parameter.

Definition at line 850 of file cfl_types.cpp.


Friends And Related Function Documentation

friend class TypeRegistry [friend]

Definition at line 1402 of file cfl_types.h.


Member Data Documentation

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.


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

libFAUDES 2.23h --- 2014.04.03 --- c++ api documentaion by doxygen