Detailed Description

Base class of all libFAUDES objects that participate in the run-time interface.

Eg, generator, alphabet, attributes etc. The class is designed to impose as little overhead as possible, and hence, does not hold any data. It does, however, provide a uniform interface for assignment, factory functions, and token IO.

We think of a faudes-typed object to be configured by defining data and, in due course, manipulated via its public interface by faudes-functions. Any faudes-type must provide a Clear() method that resets the object configuration to a unique default value. It is the configuration data that can be read from and written to token streams, and it is the configuration data that is used for assigments. Any additional data a faudes-typed object may host, is ignored by the interface inherited from the the base faudes::Type. Examples for such additional data is the unique id of a Generator, and the deferred copy pointers in faudes sets derived from faudes::TBaseSet.

The faudes::Type assignment semantics are not meant to create exact copies of a given source object. Thogether with the uniquely defined default value, we can have assignments by both up- and downcasts. A faudes::Generator can be assigned from the derived faudes::System (a Generator with controllability attributes) by dropping the extra features. Vice versa, when a System is assigned from a plain Generator, any extra features take their respective default values. This relaxed interpretation of assignments is implemented by the method Assign(). The token format for file IO is organised in a similar fashion: any generator derivate can be configured from the token stream produced by any other generator class. In contrast, faudes-typed objects also implement an assignment operator that uses the standard C++ conventions.

The following methods are used to implement the faudes::Type interface:

  • DoRead() to read the defining data from a token stream
  • DoWrite() to write the defining data to a token stream
  • DoXWrite() to write the defining data to a token stream in an alternative XML format
  • DoSWrite() and DoDWrite for alternative output formats (statistical summary and debugging)
  • Name() to get/set the name of an optional (and purely cosmetic) object name
  • Clear() to reset all configuration data,
  • New() to construct an object of identical type on heap (factory method),
  • Copy() to construct an object of identical type and configuration on heap (factory method),
  • Cast() to dynamically cast another object to this type (type check method)
  • Assign() to do an assignment from any castable Type derivate
  • DoAssign(), or the operator "=", to assign from an object with identical type.
  • Equal() to test relaxed equality with any castable Type derivate
  • DoEqual(), or the operators "==" and "!=", to test exact equality of configuration data

In most cases, only DoRead(), DoWrite(), DoAssign(), DoEqual() and Clear() need to be implemented manualy. The other methods can be declared and implemented by macros FAUDES_TYPE_DELARATION and FAUDES_TYPE_IMPLEMENTATION, respectively. The various attribute classes illustrate their ussage; see e.g. AttributeFlags.

Note on token IO: In libFAUDES 2.16e, implementation of a new file format is prepared by the virtual function interface DoXWrite(). The intention is to better support advanced XML editors, in particular for configuration files. When implementing DoXWrite() for a derived class, make sure that DoRead() will gracefully accept tokens written by both DoWrite() and DoXWrite(), as a basis for a fileformat conversion tool. Future versions of libFAUDES will drop compatibility with the old token format, except for model data (generators, alphabets).

Definition at line 239 of file cfl_types.h.

#include <cfl_types.h>

Public Member Functions

 Type (void)
 Constructor. More...
 
 Type (const Type &rType)
 Copy constructor. More...
 
virtual ~Type (void)
 Destructor. More...
 
virtual TypeNew (void) const
 Construct on heap. More...
 
virtual TypeCopy (void) const
 Construct on heap. More...
 
virtual const TypeCast (const Type *pOther) const
 Cast other object to this type. More...
 
virtual void Clear (void)
 Clear configuration data. More...
 
virtual TypeAssign (const Type &rSrc)
 Assign configuration data from other object. More...
 
Typeoperator= (const Type &rSrc)
 Assign configurationdata from other object. More...
 
virtual bool Equal (const Type &rOther) const
 Test equality of configuration data. More...
 
bool operator== (const Type &rOther) const
 Test equality of configuration data. More...
 
bool operator!= (const Type &rOther) const
 Test equality of configuration data. More...
 
virtual void Name (const std::string &rName)
 Set the objects's name. More...
 
virtual const std::string & Name (void) const
 Get objects's name. More...
 
virtual const std::string & TypeName (void) const
 Get objects's type name. More...
 
void Write (const Type *pContext=0) const
 Write configuration data to console. More...
 
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
 Write configuration data to a file. More...
 
void Write (const std::string &pFileName, std::ios::openmode openmode) const
 Write configuration data to a file. More...
 
void Write (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
 Write configuration data to TokenWriter. More...
 
virtual void XWrite (const std::string &pFileName, const std::string &rLabel="", const Type *pContext=0) const
 Write configuration data to an XML file. More...
 
void XWrite (const Type *pContext=0) const
 Write configuration data in XML format to concole Note: this write function uses the virtual function DoXWrite(), to be reimplemented by derived classes. More...
 
void XWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
 Write configuration data in XML format to TokenWriter. More...
 
std::string ToString (const std::string &rLabel="", const Type *pContext=0) const
 Write configuration data to a string. More...
 
std::string ToText (const std::string &rLabel="", const Type *pContext=0) const
 Write configuration data to a formated string. More...
 
void DWrite (const Type *pContext=0) const
 Write configuration data to console, debugging format. More...
 
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
 Write configuration data to a file, debugging format. More...
 
void DWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
 Write configuration data in debug format to TokenWriter. More...
 
void SWrite (TokenWriter &rTw) const
 Write statistics comment to TokenWriter. More...
 
void SWrite (void) const
 Write statistics comment to console. More...
 
std::string ToSText (void) const
 Write statistics to a string. More...
 
void Read (const std::string &rFileName, const std::string &rLabel="", const Type *pContext=0)
 Read configuration data from file with label specified. More...
 
void FromString (const std::string &rString, const std::string &rLabel="", const Type *pContext=0)
 Read configuration data from a string. More...
 
void Read (TokenReader &rTr, const std::string &rLabel="", const Type *pContext=0)
 Read configuration data from TokenReader with label sepcified. More...
 

Protected Member Functions

void DoAssign (const Type &rSrc)
 Assign configuration data from other object. More...
 
bool DoEqual (const Type &rOther) const
 Test equality of configuration data. More...
 
virtual void DoRead (TokenReader &rTr, const std::string &rLabel="", const Type *pContext=0)
 Read configuration data of this object from TokenReader. More...
 
virtual void DoWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
 Write configuration data of this object to TokenWriter. More...
 
virtual void DoXWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
 Write configuration data of this object to TokenWriter in XML format. More...
 
virtual void DoDWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
 Write configuration data in debugging format to TokenWriter. More...
 
virtual void DoSWrite (TokenWriter &rTw) const
 Write statistical data as a comment to TokenWriter. More...
 
virtual const TypeDefinitionTypeDefinitionp (void) const
 Get objects's type definition. More...
 
virtual Token XBeginTag (const std::string &rLabel="", const std::string &rFallbackLabel="") const
 

Static Private Attributes

static std::string msStringVoid
 
static std::string msStringEmpty
 

Constructor & Destructor Documentation

◆ Type() [1/2]

faudes::Type::Type ( void  )

Constructor.

Definition at line 45 of file cfl_types.cpp.

◆ Type() [2/2]

faudes::Type::Type ( const Type rType)

Copy constructor.

Definition at line 48 of file cfl_types.cpp.

◆ ~Type()

faudes::Type::~Type ( void  )
virtual

Destructor.

Definition at line 51 of file cfl_types.cpp.

Member Function Documentation

◆ Assign()

Type & faudes::Type::Assign ( const Type rSrc)
virtual

Assign configuration data from other object.

Derived classes should reimplement this method to first try to cast the source to the respective class. If successful, the protected function DoAssign is invoked to perform the actual assignment. If the cast fails, the Assign method of the parent class is called. Thus, faudes objects are up- and downcatsed for assignment, maintaining as much of the source data as digestable by the destination object. On the downside, there is no sensible typechecking at compile-time.

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.

Reimplemented in faudes::vGenerator, faudes::TaGenerator< GlobalAttr, StateAttr, EventAttr, TransAttr >, faudes::TmtcGenerator< GlobalAttr, StateAttr, EventAttr, TransAttr >, and faudes::TcGenerator< GlobalAttr, StateAttr, EventAttr, TransAttr >.

Definition at line 77 of file cfl_types.cpp.

◆ Cast()

const Type * faudes::Type::Cast ( const Type pOther) const
virtual

Cast other object to this type.

Enables the run-time interface to test whether pObject is derived from this object. This feature is used e.g. in the faudes container classes to test attributes. Derived classes must reimplement this function using the appropriate dynamic cast.

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

Returns
Typed pointer object

Reimplemented in faudes::vGenerator, faudes::Boolean, faudes::String, faudes::Integer, faudes::TcGenerator< GlobalAttr, StateAttr, EventAttr, TransAttr >, faudes::TaGenerator< GlobalAttr, StateAttr, EventAttr, TransAttr >, faudes::TtGenerator< GlobalAttr, StateAttr, EventAttr, TransAttr >, and faudes::TlhaGenerator< GlobalAttr, StateAttr, EventAttr, TransAttr >.

Definition at line 66 of file cfl_types.cpp.

◆ Clear()

◆ Copy()

Type * faudes::Type::Copy ( void  ) const
virtual

Construct on heap.

Technically not a constructor, this function creates an object with the same type Type and the same configuration. Copy() is defined as a virtual function and derived classes are meant to re-implement with the appropiate copy constructor. This can be done via the provided macros FAUDES_TYPE_DECLARATION and FAUDES_TYPE_IMPLEMENTATION. As with new, it is the callers reponsabilty to delete the object when no longer needed.

Returns
Pointer to new Type object

Reimplemented in faudes::vGenerator, faudes::Boolean, faudes::String, faudes::Integer, faudes::TcGenerator< GlobalAttr, StateAttr, EventAttr, TransAttr >, faudes::TaGenerator< GlobalAttr, StateAttr, EventAttr, TransAttr >, faudes::TtGenerator< GlobalAttr, StateAttr, EventAttr, TransAttr >, faudes::TmtcGenerator< GlobalAttr, StateAttr, EventAttr, TransAttr >, faudes::TioGenerator< GlobalAttr, StateAttr, EventAttr, TransAttr >, faudes::TlhaGenerator< GlobalAttr, StateAttr, EventAttr, TransAttr >, faudes::THioPlant< GlobalAttr, StateAttr, EventAttr, TransAttr >, faudes::THioPlant< AttributeVoid, HioStateFlags, HioEventFlags, AttributeVoid >, faudes::THioEnvironment< GlobalAttr, StateAttr, EventAttr, TransAttr >, faudes::THioEnvironment< AttributeVoid, HioStateFlags, HioEventFlags, AttributeVoid >, faudes::THioController< GlobalAttr, StateAttr, EventAttr, TransAttr >, faudes::THioController< AttributeVoid, HioStateFlags, HioEventFlags, AttributeVoid >, faudes::THioConstraint< GlobalAttr, StateAttr, EventAttr, TransAttr >, faudes::THioConstraint< AttributeVoid, HioStateFlags, HioEventFlags, AttributeVoid >, and faudes::TdiagGenerator< GlobalAttr, StateAttr, EventAttr, TransAttr >.

Definition at line 60 of file cfl_types.cpp.

◆ DoAssign()

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

Assign configuration data from other object.

Reimplement this function to copy all configuration data from another faudes object. Typically, you will first call the base class' DoAssign, which includes a Clear(). Then, you will set up any additional members.

Parameters
rSrcSource to copy from

Definition at line 106 of file cfl_types.cpp.

◆ DoDWrite()

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

Write configuration data in debugging format to TokenWriter.

Reimplement this method in derived classes to provide the std token io interface defined in the public section of Type.

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

Reimplemented in faudes::NameSet, faudes::vGenerator, faudes::vBaseVector, faudes::TBaseSet< T, Cmp >, faudes::TBaseSet< std::string >, faudes::TBaseSet< Idx >, faudes::TBaseSet< Transition, TransSort::X1EvX2 >, faudes::TBaseSet< T, std::less< T > >, faudes::TBaseSet< T, Cmp >, and faudes::AttributeVoid.

Definition at line 293 of file cfl_types.cpp.

◆ DoEqual()

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

Test equality of configuration data.

Derived classes should reimplement this method to compare all relevant configuration, except the name.

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

Definition at line 111 of file cfl_types.cpp.

◆ DoRead()

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

Read configuration data of this object from TokenReader.

Reimplement this method in derived classes to provide the std token io interface defined in the public section of Type.

Parameters
rTrTokenReader to read from
rLabelSection to read
pContextRead context to provide contextual information
Exceptions
Exception
  • IO error (id 1)

Reimplemented in faudes::NameSet, faudes::LinearRelation, faudes::Polyhedron, faudes::Vector, faudes::Matrix, faudes::TypeDefinition, faudes::Documentation, faudes::SymbolTable, faudes::SymbolSet, faudes::IndexSet, faudes::vGenerator, faudes::FunctionDefinition, faudes::Signature, faudes::Boolean, faudes::String, faudes::Integer, faudes::AttributeCFlags, faudes::vBaseVector, faudes::TBaseSet< T, Cmp >, faudes::TBaseSet< std::string >, faudes::TBaseSet< Idx >, faudes::TBaseSet< Transition, TransSort::X1EvX2 >, faudes::TBaseSet< T, std::less< T > >, faudes::TBaseSet< T, Cmp >, faudes::AttributeFlags, faudes::AttributeVoid, faudes::AttributeTimedGlobal, faudes::AttributeTimedState, faudes::AttributeTimedTrans, faudes::SimEventAttribute, faudes::AttributeSimCondition, faudes::ProposingExecutor, faudes::ParallelExecutor, faudes::ParallelExecutor::ParallelTimedState, faudes::LoggingExecutor, faudes::Executor, faudes::AttributeColoredState, faudes::LuaFunctionDefinition, faudes::AttributeIosState, faudes::AttributeIosEvent, faudes::vDevice, faudes::AttributeDeviceEvent, faudes::AttributeSimplenetInput, faudes::AttributeSimplenetOutput, faudes::AttributeSignalInput, faudes::AttributeSignalOutput, faudes::TlhaGenerator< GlobalAttr, StateAttr, EventAttr, TransAttr >, faudes::AttributeLhaGlobal, faudes::AttributeLhaState, faudes::AttributeLhaTrans, faudes::HioStateFlags, faudes::HioEventFlags, faudes::AttributeFailureTypeMap, faudes::AttributeFailureEvents, faudes::DiagLabelSet, and faudes::AttributeDiagnoserState.

Definition at line 307 of file cfl_types.cpp.

◆ DoSWrite()

void faudes::Type::DoSWrite ( TokenWriter rTw) const
protectedvirtual

Write statistical data as a comment to TokenWriter.

Reimplement this method in derived classes to provide the std token io interface defined in the public section of Type.

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

Reimplemented in faudes::LinearRelation, faudes::Polyhedron, faudes::Vector, faudes::Matrix, faudes::vGenerator, faudes::vBaseVector, faudes::TBaseSet< T, Cmp >, faudes::TBaseSet< std::string >, faudes::TBaseSet< Idx >, faudes::TBaseSet< Transition, TransSort::X1EvX2 >, faudes::TBaseSet< T, std::less< T > >, faudes::TBaseSet< T, Cmp >, and faudes::TmtcGenerator< GlobalAttr, StateAttr, EventAttr, TransAttr >.

Definition at line 299 of file cfl_types.cpp.

◆ DoWrite()

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

Write configuration data of this object to TokenWriter.

Reimplement this method in derived classes to provide the std token io interface defined in the public section of Type.

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

Reimplemented in faudes::SymbolSet, faudes::NameSet, faudes::IndexSet, faudes::LinearRelation, faudes::Polyhedron, faudes::Vector, faudes::Matrix, faudes::TypeDefinition, faudes::Documentation, faudes::TTransSet< Cmp >, faudes::TTransSet< TransSort::X1EvX2 >, faudes::SymbolTable, faudes::FunctionRegistry, faudes::TypeRegistry, faudes::vGenerator, faudes::Function, faudes::FunctionDefinition, faudes::Signature, faudes::Boolean, faudes::String, faudes::Integer, faudes::AttributeCFlags, faudes::vBaseVector, faudes::TBaseSet< T, Cmp >, faudes::TBaseSet< std::string >, faudes::TBaseSet< Idx >, faudes::TBaseSet< Transition, TransSort::X1EvX2 >, faudes::TBaseSet< T, std::less< T > >, faudes::TBaseSet< T, Cmp >, faudes::AttributeFlags, faudes::AttributeVoid, faudes::AttributeTimedGlobal, faudes::AttributeTimedState, faudes::AttributeTimedTrans, faudes::SimEventAttribute, faudes::AttributeSimCondition, faudes::ProposingExecutor, faudes::ParallelExecutor, faudes::ParallelExecutor::ParallelTimedState, faudes::LoggingExecutor, faudes::Executor, faudes::AttributeColoredState, faudes::LuaFunctionDefinition, faudes::AttributeIosState, faudes::AttributeIosEvent, faudes::vDevice, faudes::AttributeDeviceEvent, faudes::AttributeSimplenetInput, faudes::AttributeSimplenetOutput, faudes::AttributeSignalInput, faudes::AttributeSignalOutput, faudes::TlhaGenerator< GlobalAttr, StateAttr, EventAttr, TransAttr >, faudes::AttributeLhaGlobal, faudes::AttributeLhaState, faudes::AttributeLhaTrans, faudes::HioStateFlags, faudes::HioEventFlags, faudes::AttributeFailureTypeMap, faudes::DiagLabelSet, faudes::AttributeFailureEvents, and faudes::AttributeDiagnoserState.

Definition at line 282 of file cfl_types.cpp.

◆ DoXWrite()

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

Write configuration data of this object to TokenWriter in XML format.

Reimplement this method in derived classes to provide the XML token io interface defined in the public section of Type. The default implementation invokes the std token output via DoWrite(TokenWriter&, const std::string&,const Type* )

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

Reimplemented in faudes::NameSet, faudes::IndexSet, faudes::vGenerator, faudes::AttributeCFlags, faudes::AttributeFlags, faudes::AttributeColoredState, faudes::AttributeIosState, faudes::AttributeIosEvent, faudes::AttributeLhaState, faudes::AttributeLhaTrans, faudes::AttributeFailureTypeMap, faudes::DiagLabelSet, faudes::AttributeFailureEvents, and faudes::AttributeDiagnoserState.

Definition at line 288 of file cfl_types.cpp.

◆ DWrite() [1/3]

void faudes::Type::DWrite ( const std::string &  pFileName,
const std::string &  rLabel = "",
const Type pContext = 0,
std::ios::openmode  openmode = std::ios::out|std::ios::trunc 
) const

Write configuration data to a file, debugging format.

Note: this write function uses the virtual function DoDWrite(), to be reimplemented by derived classes.

Parameters
pFileNameName of file
rLabelLabel of section to write
pContextWrite context to provide contextual information
openmodeios::openmode
Exceptions
Exception
  • IO errors (id 2)

Definition at line 231 of file cfl_types.cpp.

◆ DWrite() [2/3]

void faudes::Type::DWrite ( const Type pContext = 0) const

Write configuration data to console, debugging format.

Note: this write function uses the virtual function DoDWrite(), to be reimplemented by derived classes.

Parameters
pContextWrite context to provide contextual information

Definition at line 225 of file cfl_types.cpp.

◆ DWrite() [3/3]

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

Write configuration data in debug format to TokenWriter.

Note: this write function uses the virtual function DoWrite(), to be reimplemented by derived classes.

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

Definition at line 245 of file cfl_types.cpp.

◆ Equal()

bool faudes::Type::Equal ( const Type rOther) const
virtual

Test equality of configuration data.

Derived classes should reimplement this method to return true if both actual types and configuration data match. The object name or id (if any) is not considered in the test.

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 object to compare with.
Returns
True on match.

Definition at line 84 of file cfl_types.cpp.

◆ FromString()

void faudes::Type::FromString ( const std::string &  rString,
const std::string &  rLabel = "",
const Type pContext = 0 
)

Read configuration data from a string.

Note: this read function uses the virtual function DoRead(), to be reimplemented by derived classes.

Parameters
rStringString to read from
rLabelSection to read
pContextRead context to provide contextual information
Exceptions
Exception
  • IO errors (id 1)
  • token mismatch from DoRead()

Definition at line 275 of file cfl_types.cpp.

◆ Name() [1/2]

void faudes::Type::Name ( const std::string &  rName)
virtual

◆ Name() [2/2]

const std::string & faudes::Type::Name ( void  ) const
virtual

◆ New()

Type * faudes::Type::New ( void  ) const
virtual

Construct on heap.

Technically not a constructor, this function creates an object with the same type Type. New() is defined as a virtual function and derived classes are meant to re-implement with the appropiate constructor. This can be done via the provided macros FAUDES_TYPE_DECLARATION and FAUDES_TYPE_IMPLEMENTATION. As with new, it is the callers reponsabilty to delete the object when no longer needed.

Returns
Pointer to new Type object

Reimplemented in faudes::vGenerator, faudes::Boolean, faudes::String, faudes::Integer, faudes::TcGenerator< GlobalAttr, StateAttr, EventAttr, TransAttr >, faudes::TaGenerator< GlobalAttr, StateAttr, EventAttr, TransAttr >, faudes::TtGenerator< GlobalAttr, StateAttr, EventAttr, TransAttr >, faudes::TmtcGenerator< GlobalAttr, StateAttr, EventAttr, TransAttr >, faudes::TioGenerator< GlobalAttr, StateAttr, EventAttr, TransAttr >, faudes::TlhaGenerator< GlobalAttr, StateAttr, EventAttr, TransAttr >, faudes::THioPlant< GlobalAttr, StateAttr, EventAttr, TransAttr >, faudes::THioPlant< AttributeVoid, HioStateFlags, HioEventFlags, AttributeVoid >, faudes::THioEnvironment< GlobalAttr, StateAttr, EventAttr, TransAttr >, faudes::THioEnvironment< AttributeVoid, HioStateFlags, HioEventFlags, AttributeVoid >, faudes::THioController< GlobalAttr, StateAttr, EventAttr, TransAttr >, faudes::THioController< AttributeVoid, HioStateFlags, HioEventFlags, AttributeVoid >, faudes::THioConstraint< GlobalAttr, StateAttr, EventAttr, TransAttr >, faudes::THioConstraint< AttributeVoid, HioStateFlags, HioEventFlags, AttributeVoid >, faudes::TdiagGenerator< GlobalAttr, StateAttr, EventAttr, TransAttr >, faudes::Function, and faudes::LuaFunction.

Definition at line 54 of file cfl_types.cpp.

◆ operator!=()

bool faudes::Type::operator!= ( const Type rOther) const

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

◆ operator=()

Type & faudes::Type::operator= ( const Type rSrc)

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

◆ operator==()

bool faudes::Type::operator== ( const Type rOther) const

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

◆ Read() [1/2]

void faudes::Type::Read ( const std::string &  rFileName,
const std::string &  rLabel = "",
const Type pContext = 0 
)

Read configuration data from file with label specified.

Note: all read functions use the virtual function DoRead(), to be reimplemented for by derived classes.

Parameters
rFileNameName of file
rLabelSection to read from
pContextRead context to provide contextual information
Exceptions
Exception
  • IO errors (id 1)
  • token mismatch from DoRead()

Definition at line 261 of file cfl_types.cpp.

◆ Read() [2/2]

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

Read configuration data from TokenReader with label sepcified.

Note: all read functions use the virtual function DoRead(), to be reimplemented for by derived classes.

Parameters
rTrReference to tokenreader
rLabelSection to read
pContextRead context to provide contextual information
Exceptions
Exception
  • IO errors (id 1)
  • token mismatch from DoRead()

Definition at line 269 of file cfl_types.cpp.

◆ SWrite() [1/2]

void faudes::Type::SWrite ( TokenWriter rTw) const

Write statistics comment to TokenWriter.

Note: this write function use the virtual function DoSWrite(), to be reimplemented by derived classes.

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

Definition at line 256 of file cfl_types.cpp.

◆ SWrite() [2/2]

void faudes::Type::SWrite ( void  ) const

Write statistics comment to console.

Note: this write function uses the virtual function DoSWrite(), to be reimplemented by derived classes.

Definition at line 250 of file cfl_types.cpp.

◆ ToSText()

std::string faudes::Type::ToSText ( void  ) const

Write statistics to a string.

Note: this write function uses the virtual function DoSWrite(), to be reimplemented by derived classes.

Returns
output string
Exceptions
Exception
  • IO errors (id 2)

Definition at line 177 of file cfl_types.cpp.

◆ ToString()

std::string faudes::Type::ToString ( const std::string &  rLabel = "",
const Type pContext = 0 
) const

Write configuration data to a string.

Note: this write function uses the virtual function DoWrite(), to be reimplemented by derived classes.

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

Definition at line 169 of file cfl_types.cpp.

◆ ToText()

std::string faudes::Type::ToText ( const std::string &  rLabel = "",
const Type pContext = 0 
) const

Write configuration data to a formated string.

In contrast to ToString, ToText does not suppress comments and End-Of-Line marks. Note: this write function uses the virtual function DoWrite(), to be reimplemented by derived classes.

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

Definition at line 185 of file cfl_types.cpp.

◆ TypeDefinitionp()

const TypeDefinition * faudes::Type::TypeDefinitionp ( void  ) const
protectedvirtual

Get objects's type definition.

Returns the type definition corresponding to this object, or NULL if the object is not of a registered type.

Technical note: for minimal memory requirement, the type definition is not cached but retrieved on every invokation of this method. Derived classes may reimplement this method for performance reasons. Options include a look-up cache or a static member for the actual type definition. The latter variant will make the type independant from the type registry.

Returns
Type definition reference.

Reimplemented in faudes::TBaseSet< T, Cmp >, faudes::TBaseSet< std::string >, faudes::TBaseSet< Idx >, faudes::TBaseSet< Transition, TransSort::X1EvX2 >, faudes::TBaseSet< T, std::less< T > >, and faudes::TBaseSet< T, Cmp >.

Definition at line 127 of file cfl_types.cpp.

◆ TypeName()

const std::string & faudes::Type::TypeName ( void  ) const
virtual

Get objects's type name.

Retrieve the faudes-type name from the type registry. This method silently returns the empty string if the type is not (yet) registered.

Returns
Faudes-type name or empty string.

Reimplemented in faudes::TypeRegistry, faudes::TBaseSet< T, Cmp >, faudes::TBaseSet< std::string >, faudes::TBaseSet< Idx >, faudes::TBaseSet< Transition, TransSort::X1EvX2 >, faudes::TBaseSet< T, std::less< T > >, and faudes::TBaseSet< T, Cmp >.

Definition at line 132 of file cfl_types.cpp.

◆ Write() [1/4]

void faudes::Type::Write ( const std::string &  pFileName,
const std::string &  rLabel = "",
const Type pContext = 0,
std::ios::openmode  openmode = std::ios::out|std::ios::trunc 
) const

Write configuration data to a file.

Note: this write function uses the virtual function DoWrite(), to be reimplemented by derived classes.

Parameters
pFileNameName of file
rLabelLabel of section to write
pContextWrite context to provide contextual information
openmodeios::openmode
Exceptions
Exception
  • IO errors (id 2)

Definition at line 145 of file cfl_types.cpp.

◆ Write() [2/4]

void faudes::Type::Write ( const std::string &  pFileName,
std::ios::openmode  openmode 
) const

Write configuration data to a file.

Note: this write function uses the virtual function DoWrite(), to be reimplemented by derived classes.

Parameters
pFileNameName of file
openmodeios::openmode
Exceptions
Exception
  • IO errors (id 2)

Definition at line 159 of file cfl_types.cpp.

◆ Write() [3/4]

void faudes::Type::Write ( const Type pContext = 0) const

Write configuration data to console.

Note: this write function uses the virtual function DoWrite(), to be reimplemented by derived classes.

Parameters
pContextWrite context to provide contextual information

Definition at line 139 of file cfl_types.cpp.

◆ Write() [4/4]

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

Write configuration data to TokenWriter.

Note: this write function uses the virtual function DoWrite(), to be reimplemented by derived classes.

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

Definition at line 164 of file cfl_types.cpp.

◆ XBeginTag()

Token faudes::Type::XBeginTag ( const std::string &  rLabel = "",
const std::string &  rFallbackLabel = "" 
) const
protectedvirtual

Definition at line 315 of file cfl_types.cpp.

◆ XWrite() [1/3]

void faudes::Type::XWrite ( const std::string &  pFileName,
const std::string &  rLabel = "",
const Type pContext = 0 
) const
virtual

Write configuration data to an XML file.

Note: this method uses the faudes type to set a DOCTYPE markup; for derived classes which do not report their faudes type, you should reimplement this function. Actual token io is done via DoXWrite().

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

Definition at line 200 of file cfl_types.cpp.

◆ XWrite() [2/3]

void faudes::Type::XWrite ( const Type pContext = 0) const

Write configuration data in XML format to concole Note: this write function uses the virtual function DoXWrite(), to be reimplemented by derived classes.

No DOCTYPE markup will be written.

Parameters
pContextWrite context to provide contextual information

Definition at line 193 of file cfl_types.cpp.

◆ XWrite() [3/3]

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

Write configuration data in XML format to TokenWriter.

Note: this write function uses the virtual function DoXWrite(), to be reimplemented by derived classes.

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

Definition at line 219 of file cfl_types.cpp.

Member Data Documentation

◆ msStringEmpty

std::string faudes::Type::msStringEmpty
staticprivate

Definition at line 859 of file cfl_types.h.

◆ msStringVoid

std::string faudes::Type::msStringVoid
staticprivate

Definition at line 858 of file cfl_types.h.


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

libFAUDES 2.32f --- 2024.12.22 --- c++ api documentaion by doxygen