libFAUDES

Sections

Index

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

#include <rtitypes.h>

Inherits faudes::Documentation.

List of all members.


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 1048 of file rtitypes.h.


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.
void MergeDocumentationBody (TokenReader &rTr)
 Merge documentation and from token stream.

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

 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).
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 DoWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
 Write configuration data of this object to TokenWriter.

Protected Attributes

TypempType
 Type-pointer to store address of libFAUDES-Type instance.

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 1060 of file rtitypes.h.

virtual faudes::TypeDefinition::~TypeDefinition ( void   )  [inline, virtual]

Destructor.

Delete prototype object.

Definition at line 1067 of file rtitypes.h.

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

Disable copy constructor.

Definition at line 1165 of file rtitypes.h.


Member Function Documentation

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 1696 of file rtitypes.h.

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 470 of file rtitypes.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 1704 of file rtitypes.h.

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 535 of file rtitypes.cpp.

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 546 of file rtitypes.cpp.

void faudes::TypeDefinition::MergeDocumentationBody ( TokenReader rTr  ) 

Merge documentation and from token stream.

This member reads the body of the TypeDefinition token format and sets the documentation and accordingly. An exception is thrown if the current type name differs from the one in the documentation.

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

Definition at line 481 of file rtitypes.cpp.

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 556 of file rtitypes.cpp.

void faudes::TypeDefinition::Prototype ( faudes::Type pType  )  [protected]

Use given object as prototype.

The TypeDefinition takes ownership of the provided object.

Parameters:
pType Any class that inherits Type.

Definition at line 540 of file rtitypes.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 is hardcode to "TypeDefinition", context ignored.

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

Reimplemented from faudes::Documentation.

Definition at line 501 of file rtitypes.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 is hardcode to "TypeDefinition", context ignored.

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 522 of file rtitypes.cpp.


Member Data Documentation

Type-pointer to store address of libFAUDES-Type instance.

Definition at line 1219 of file rtitypes.h.


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

libFAUDES 2.14g --- 2009-12-3 --- c++ source docu by doxygen 1.5.6