#include <cfl_types.h>

Public Member Functions

 TypeDefinition (const std::string &name="")
 
virtual ~TypeDefinition (void)
 
const TypePrototype (void) const
 
TypeNewObject (void) const
 
const std::string & XElementTag (void) const
 
void XElementTag (const std::string &rTag)
 
Typeoperator= (const Type &rSrc)
 
bool operator== (const Type &rOther) const
 
bool operator!= (const Type &rOther) const
 
- Public Member Functions inherited from faudes::Documentation
 Documentation (void)
 
 Documentation (const Documentation &rOther)
 
virtual ~Documentation (void)
 
const std::string & Name (void) const
 
const std::string & PlugIn (void) const
 
const std::string & CType (void) const
 
const std::string & TextDoc (void) const
 
const std::string & HtmlDoc (void) const
 
const std::string & Keywords (void) const
 
std::string MatchKeyword (const std::string &rPattern) const
 
int KeywordsSize (void) const
 
std::string KeywordAt (int pos) const
 
bool AutoRegistered (void) const
 
bool ApplicationRegistered (void) const
 
virtual void MergeDocumentation (TokenReader &rTr)
 
Typeoperator= (const Type &rSrc)
 
bool operator== (const Type &rOther) const
 
bool operator!= (const Type &rOther) const
 
- Public Member Functions inherited from faudes::Type
 Type (void)
 
 Type (const Type &rType)
 
virtual ~Type (void)
 
virtual TypeNew (void) const
 
virtual TypeCopy (void) const
 
virtual const TypeCast (const Type *pOther) const
 
virtual TypeAssign (const Type &rSrc)
 
Typeoperator= (const Type &rSrc)
 
virtual bool Equal (const Type &rOther) const
 
bool operator== (const Type &rOther) const
 
bool operator!= (const Type &rOther) const
 
virtual const std::string & TypeName (void) const
 
void Write (const Type *pContext=0) const
 
void Write (const std::string &pFileName, const std::string &rLabel="", const Type *pContext=0, std::ios::openmode openmode=std::ios::out|std::ios::trunc) const
 
void Write (const std::string &pFileName, std::ios::openmode openmode) const
 
void Write (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
 
virtual void XWrite (const std::string &pFileName, const std::string &rLabel="", const Type *pContext=0) const
 
void XWrite (const Type *pContext=0) const
 
void XWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
 
std::string ToString (const std::string &rLabel="", const Type *pContext=0) const
 
std::string ToText (const std::string &rLabel="", const Type *pContext=0) const
 
void DWrite (const Type *pContext=0) const
 
void DWrite (const std::string &pFileName, const std::string &rLabel="", const Type *pContext=0, std::ios::openmode openmode=std::ios::out|std::ios::trunc) const
 
void DWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
 
void SWrite (TokenWriter &rTw) const
 
void SWrite (void) const
 
std::string ToSText (void) const
 
void Read (const std::string &rFileName, const std::string &rLabel="", const Type *pContext=0)
 
void FromString (const std::string &rString, const std::string &rLabel="", const Type *pContext=0)
 
void Read (TokenReader &rTr, const std::string &rLabel="", const Type *pContext=0)
 

Static Public Member Functions

template<class T >
static TypeDefinitionConstructor (const std::string &rTypeName="")
 
static TypeDefinitionConstructor (Type *pProto, const std::string &rTypeName="")
 
template<class T >
static TypeDefinitionFromFile (const std::string &rFileName)
 

Protected Member Functions

void DoAssign (const TypeDefinition &rSrc)
 
bool DoEqual (const TypeDefinition &rOther) const
 
 TypeDefinition (const TypeDefinition &rOther)
 
void Clear (void)
 
virtual void Prototype (Type *pType)
 
virtual void DoRead (TokenReader &rTr, const std::string &rLabel="", const Type *pContext=0)
 
virtual void DoReadCore (TokenReader &rTr)
 
virtual void DoWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
 
virtual void DoWriteCore (TokenWriter &rTw) const
 
- Protected Member Functions inherited from faudes::Documentation
void Name (const std::string &name)
 
void PlugIn (const std::string &plugin)
 
void CType (const std::string &name)
 
void TextDoc (const std::string &textdoc)
 
void AutoRegistered (bool flag)
 
void ApplicationRegistered (bool flag)
 
void HtmlDoc (const std::string &fname)
 
void AddKeyword (const std::string &rKeyword)
 
void DoAssign (const Documentation &rSrc)
 
bool DoEqual (const Documentation &rOther) const
 
- Protected Member Functions inherited from faudes::Type
void DoAssign (const Type &rSrc)
 
bool DoEqual (const Type &rOther) const
 
virtual void DoXWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
 
virtual void DoDWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
 
virtual void DoSWrite (TokenWriter &rTw) const
 
virtual const TypeDefinitionTypeDefinitionp (void) const
 
virtual Token XBeginTag (const std::string &rLabel="", const std::string &rFallbackLabel="") const
 

Protected Attributes

TypempType
 
std::string mXElementTag
 
- Protected Attributes inherited from faudes::Documentation
std::string mName
 
std::string mPlugIn
 
std::string mCType
 
std::string mTextDoc
 
std::string mHtmlDoc
 
std::string mKeywords
 
bool mAutoRegistered
 
bool mApplicationRegistered
 

Friends

class TypeRegistry
 

Additional Inherited Members

- Static Protected Attributes inherited from faudes::Documentation
static const char mDelim = ';'
 

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 1368 of file cfl_types.h.

Constructor & Destructor Documentation

◆ TypeDefinition() [1/2]

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 1390 of file cfl_types.h.

◆ ~TypeDefinition()

virtual faudes::TypeDefinition::~TypeDefinition ( void  )
inlinevirtual

Destructor.

Delete prototype object.

Definition at line 1397 of file cfl_types.h.

◆ TypeDefinition() [2/2]

faudes::TypeDefinition::TypeDefinition ( const TypeDefinition rOther)
inlineprotected

Disable copy constructor

Definition at line 1517 of file cfl_types.h.

Member Function Documentation

◆ Clear()

void faudes::TypeDefinition::Clear ( void  )
protectedvirtual

Clear documentation-data; do NOT delete prototype (this is for using Read to merge/overwrite documentation)

Reimplemented from faudes::Documentation.

Definition at line 723 of file cfl_types.cpp.

◆ Constructor() [1/2]

template<class T >
TypeDefinition * faudes::TypeDefinition::Constructor ( const std::string &  rTypeName = "")
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
TActual c class, derived from Type
Parameters
rTypeNameName 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 1625 of file cfl_types.h.

◆ Constructor() [2/2]

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
pProtoPrototype, derived from Type
rTypeNameName 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 711 of file cfl_types.cpp.

◆ DoAssign()

void faudes::TypeDefinition::DoAssign ( const TypeDefinition rSrc)
protected

Std faudes type interface: assignment.

Parameters
rSrcSource to copy from

Definition at line 733 of file cfl_types.cpp.

◆ DoEqual()

bool faudes::TypeDefinition::DoEqual ( const TypeDefinition rOther) const
protected

Std faudes type interface: test equality

Parameters
rOtherOther object to compare with.
Returns
True on match.

Definition at line 746 of file cfl_types.cpp.

◆ DoRead()

void faudes::TypeDefinition::DoRead ( TokenReader rTr,
const std::string &  rLabel = "",
const Type pContext = 0 
)
protectedvirtual

Read configuration data of this object from TokenReader.

The section defaults to "TypeDefinition", context ignored. Actual reading is done by DoReadCore.

Parameters
rTrTokenReader to read from
rLabelSection to read
pContextRead 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 756 of file cfl_types.cpp.

◆ DoReadCore()

void faudes::TypeDefinition::DoReadCore ( TokenReader rTr)
protectedvirtual

Read configuration data of this object from TokenReader.

This method reads members only, it does not read the section.

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

Reimplemented from faudes::Documentation.

Definition at line 769 of file cfl_types.cpp.

◆ DoWrite()

void faudes::TypeDefinition::DoWrite ( TokenWriter rTw,
const std::string &  rLabel = "",
const Type pContext = 0 
) const
protectedvirtual

Write configuration data of this object to TokenWriter.

The section defaults to "TypeDefinition", context ignored. Actual writing is done by DoWriteCore.

Parameters
rTwReference to TokenWriter
rLabelLabel of section to write
pContextWrite context to provide contextual information
Exceptions
Exception
  • IO errors (id 2)

Reimplemented from faudes::Documentation.

Definition at line 792 of file cfl_types.cpp.

◆ DoWriteCore()

void faudes::TypeDefinition::DoWriteCore ( TokenWriter rTw) const
protectedvirtual

Write configuration data of this object to TokenWriter.

This method wrtite plain member data, the section lables are not written.

Parameters
rTwReference to TokenWriter
Exceptions
Exception
  • IO errors (id 2)

Reimplemented from faudes::Documentation.

Definition at line 801 of file cfl_types.cpp.

◆ FromFile()

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

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

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

Definition at line 1633 of file cfl_types.h.

◆ NewObject()

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 837 of file cfl_types.cpp.

◆ operator!=()

bool faudes::Type::operator!=

Test equality of configuration data. See operator==(const Type&).

This method calls the virtual method DoEqual(). Re-implementation can be done via the convenience macros FAUDES_TYPE_DECLARATION and FAUDES_TYPE_IMPLEMENTATION.

Parameters
rOtherOther objevt to compare with.
Returns
True on mismatch.

Definition at line 1038 of file cfl_types.cpp.

◆ operator=()

Type & faudes::Type::operator=

Assign configurationdata from other object. Derived classes should implement the operator form for the assignment for each source type which allows for a non-trivial assignment. This includes the particular case were the source and destination types match exactly. In the latter case the DoAssign method should be invoked. In contrast to the Assign function, the operator form must not be reimplemented for missmatched source types: the operator form only accepts sensible source types. This allows for compiletime typeckecking. However, the downside is that when the type is not known at compiletime, configuration is not properly assigned.

Re-implementation can be done via the convenience macros FAUDES_TYPE_DECLARATION and FAUDES_TYPE_IMPLEMENTATION.

Parameters
rSrcSource to copy from
Returns
Reference to this object.

Definition at line 1036 of file cfl_types.cpp.

◆ operator==()

bool faudes::Type::operator==

Test equality of configuration data. The operator form of the equality test is only defined for matching types, no cast will be performed. Thus, the test will be optimistic if the type is not known at compiletime. The object name or id is not considered in the test.

This methoc calls the virtual method DoEqual(). Re-implementation can be done via the convenience macros FAUDES_TYPE_DECLARATION and FAUDES_TYPE_IMPLEMENTATION.

Parameters
rOtherOther object to compare with.
Returns
True on match.

Definition at line 1037 of file cfl_types.cpp.

◆ Prototype() [1/2]

void faudes::TypeDefinition::Prototype ( faudes::Type pType)
protectedvirtual

Use given object as prototype.

The TypeDefinition takes ownership of the provided object.

Parameters
pTypeAny class that inherits Type.

Definition at line 821 of file cfl_types.cpp.

◆ Prototype() [2/2]

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 816 of file cfl_types.cpp.

◆ XElementTag() [1/2]

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

Parameter access: Xml Element Tag

Parameters
rTagNew tag parameter

Definition at line 853 of file cfl_types.cpp.

◆ XElementTag() [2/2]

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 848 of file cfl_types.cpp.

Friends And Related Function Documentation

◆ TypeRegistry

friend class TypeRegistry
friend

Definition at line 1374 of file cfl_types.h.

Member Data Documentation

◆ mpType

Type* faudes::TypeDefinition::mpType
protected

Type-pointer tp prototype instance

Definition at line 1602 of file cfl_types.h.

◆ mXElementTag

std::string faudes::TypeDefinition::mXElementTag
protected

Extra documentation/parameter: Xml Element Tag

Definition at line 1605 of file cfl_types.h.


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

libFAUDES 2.33c --- 2025.05.15 --- c++ api documentaion by doxygen