Detailed Description

Minimal Attribute.

Attributes are used as template parameters for faudes containers and generators and facilitate the modelling of customized
properties of events, states and transitions. The AttributeVoid class defines the minimal interface of faudes attributes and therefore is the designated base class for all attribute implementations. The AttributeVoid class does not define any actual properties. See AttributeFlags for a non-trivial example.

To derive a class from AttributeVoid you should reimplement the virtual interface

Definition at line 52 of file cfl_attributes.h.

#include <cfl_attributes.h>

Public Member Functions

 AttributeVoid (void)
 Constructor. More...
 
 AttributeVoid (const AttributeVoid &rSrcAttr)
 Copy Constructor. More...
 
virtual ~AttributeVoid (void)
 Destructor. More...
 
virtual bool IsDefault (void) const
 Test for default value. More...
 
virtual void SetDefault (void)
 Set to default value. More...
 
virtual void Clear (void)
 Synonym for SetDefault to match std interface. More...
 
Typeoperator= (const Type &rSrc)
 Assign configurationdata from other object. 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...
 
- Public Member Functions inherited from faudes::Type
 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 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...
 

Static Public Member Functions

static void Skip (TokenReader &rTr)
 Skip attribute tokens. More...
 

Protected Member Functions

void DoAssign (const AttributeVoid &rSrcAttr)
 Assign attribute members. More...
 
bool DoEqual (const AttributeVoid &rOther) const
 Test equality of configuration data. More...
 
virtual void DoRead (TokenReader &rTr, const std::string &rLabel="", const Type *pContext=0)
 Actual read method to read attribute from tokenreader. More...
 
virtual void DoDWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
 Actual write method to write the attribute to a TokenWriter. More...
 
virtual void DoWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
 Actual write method to write the attribute to a TokenWriter. More...
 
- Protected Member Functions inherited from faudes::Type
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 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 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
 

Constructor & Destructor Documentation

◆ AttributeVoid() [1/2]

faudes::AttributeVoid::AttributeVoid ( void  )

Constructor.

Definition at line 39 of file cfl_attributes.cpp.

◆ AttributeVoid() [2/2]

faudes::AttributeVoid::AttributeVoid ( const AttributeVoid rSrcAttr)

Copy Constructor.

Definition at line 44 of file cfl_attributes.cpp.

◆ ~AttributeVoid()

faudes::AttributeVoid::~AttributeVoid ( void  )
virtual

Destructor.

Definition at line 50 of file cfl_attributes.cpp.

Member Function Documentation

◆ Clear()

◆ DoAssign()

void faudes::AttributeVoid::DoAssign ( const AttributeVoid rSrcAttr)
inlineprotected

Assign attribute members.

Since AttributeVoid has no members, this method does nothing. Derived classes are meant to reimplement DoAssign by first calling their base and then assigning additional member variables.

Parameters
rSrcAttrSource to assign from

Definition at line 112 of file cfl_attributes.h.

◆ DoDWrite()

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

Actual write method to write the attribute to a TokenWriter.

Reimplement this method for derived attribute classes to define the token io format. See Type::Write for public wrappers.

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

Reimplemented from faudes::Type.

Definition at line 61 of file cfl_attributes.cpp.

◆ DoEqual()

bool faudes::AttributeVoid::DoEqual ( const AttributeVoid rOther) const
inlineprotected

Test equality of configuration data.

Derived attributes should reimplement this class to compare configuration data. The base AttributeVoid returns true as a default.

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

Definition at line 123 of file cfl_attributes.h.

◆ DoRead()

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

Actual read method to read attribute from tokenreader.

For derived attributue classes, this method must either read all tokens that belong to the respective attribute, or none. It may throw exceptions on token mismatch within the relevant attribute, but it may not throw exceptions when it encounters tokens that possibly belong to another attribute. The latter are to be skipped by the provided Skip method. See Type::Read for public wrappers.

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

Reimplemented from faudes::Type.

Reimplemented in faudes::AttributeCFlags, faudes::AttributeFlags, faudes::AttributeTimedGlobal, faudes::AttributeTimedState, faudes::AttributeTimedTrans, faudes::SimEventAttribute, faudes::AttributeSimCondition, faudes::AttributeColoredState, faudes::AttributeIosState, faudes::AttributeIosEvent, faudes::AttributeDeviceEvent, faudes::AttributeSimplenetInput, faudes::AttributeSimplenetOutput, faudes::AttributeSignalInput, faudes::AttributeSignalOutput, faudes::AttributeLhaGlobal, faudes::AttributeLhaState, faudes::AttributeLhaTrans, faudes::HioStateFlags, faudes::HioEventFlags, faudes::AttributeFailureTypeMap, faudes::AttributeFailureEvents, faudes::DiagLabelSet, and faudes::AttributeDiagnoserState.

Definition at line 69 of file cfl_attributes.cpp.

◆ DoWrite()

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

◆ IsDefault()

◆ 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 391 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 340 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 375 of file cfl_types.cpp.

◆ SetDefault()

virtual void faudes::AttributeVoid::SetDefault ( void  )
inlinevirtual

Set to default value.

Derived classes must reimplement this function for Clear to operate properly.

Definition at line 80 of file cfl_attributes.h.

◆ Skip()

void faudes::AttributeVoid::Skip ( TokenReader rTr)
static

Skip attribute tokens.

Helper method to be called after all sttribute derived classes had their chance to read their data. It skips all tokens and sections until it reaches a String or decimal Integer.

Parameters
rTrTokenReader to read from
Exceptions
Exception
  • IO error (id 1)

Definition at line 75 of file cfl_attributes.cpp.


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

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