#include <cfl_functions.h>

Public Member Functions

 Signature (void)
 
 Signature (const Signature &rSrc)
 
 ~Signature (void)
 
const std::string & Name (void) const
 
void Name (const std::string &rName)
 
void Clear (void)
 
int Size (void) const
 
const ParameterAt (int n) const
 
void At (int n, const Parameter &rParam)
 
void Append (const Parameter &rParam)
 
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)
 

Protected Member Functions

void DoAssign (const Signature &rSrc)
 
bool DoEqual (const Signature &rOther) const
 
virtual void DoRead (TokenReader &rTr, const std::string &rLabel="", const Type *pContext=0)
 
virtual void DoWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) 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

std::string mName
 
std::vector< ParametermParameters
 

Detailed Description

Signature of a Function.

A Signature describes the faudes types of the positional parameters. Tecnically, a Signature is a vector of Parameters. Each Function may execute serveral variants indicated by setting a particular Signature. A list of valid Signatures is maintained in the coresponding FunctionDefinition.

Core members are

  • mName: string to identify ths signature
  • mParameters: vector of Paramters.

The Signature is formally derived from Type to inherit the std token io interface. It is not meant to be registered as a faudes type. The token io format is demonstrated by the following example:

<Signature name="Sum of two integers">
<Parameter name="arg1" ftype="Integer" access="InOut"/>
<Parameter name="arg2" ftype="Integer" access="In"/>
<Parameter name="res" ftype="String" access="Out" creturn="true"/>

Technical note: the variable parameter feature offered by FunctionDefinition is a purely cosmetic hack implemented in FunctionDefinition:MergeDocumentation. It is superseeded by vector parameters and will hence disappear in a future implementation.

Definition at line 220 of file cfl_functions.h.

Constructor & Destructor Documentation

◆ Signature() [1/2]

faudes::Signature::Signature ( void  )

Constructor

Definition at line 151 of file cfl_functions.cpp.

◆ Signature() [2/2]

faudes::Signature::Signature ( const Signature rSrc)

Copy constructor

Definition at line 154 of file cfl_functions.cpp.

◆ ~Signature()

faudes::Signature::~Signature ( void  )
inline

Destructor

Definition at line 238 of file cfl_functions.h.

Member Function Documentation

◆ Append()

void faudes::Signature::Append ( const Parameter rParam)

Append positional parameter.

Parameters
rParamParameter to append

Definition at line 222 of file cfl_functions.cpp.

◆ At() [1/2]

const Parameter & faudes::Signature::At ( int  n) const

Get parameter type by position.

Parameters
nPosition of patameter.
Exceptions
Exception
  • Index out of range

Definition at line 198 of file cfl_functions.cpp.

◆ At() [2/2]

void faudes::Signature::At ( int  n,
const Parameter rParam 
)

Set parameter type by position.

Parameters
nPosition of patameter.
rParamParaeter value
Exceptions
Exception
  • Index out of range

Definition at line 210 of file cfl_functions.cpp.

◆ Clear()

void faudes::Signature::Clear ( void  )
virtual

Clear signature

Reimplemented from faudes::Type.

Definition at line 176 of file cfl_functions.cpp.

◆ DoAssign()

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

Std faudes type interface: assignment.

Parameters
rSrcSource to copy from

Definition at line 160 of file cfl_functions.cpp.

◆ DoEqual()

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

Std faudes type interface: test equality

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

Definition at line 167 of file cfl_functions.cpp.

◆ DoRead()

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

Read signature from from TokenReader.

The section is hardcoded to "Signature", context is ignored.

Parameters
rTrTokenReader to read from
rLabelSection to read
pContextRead context to provide contextual information (ignored)
Exceptions
Exception
  • IO error (id 1)
  • Token mismatch (id 50, 51, 52)

Reimplemented from faudes::Type.

Definition at line 258 of file cfl_functions.cpp.

◆ DoWrite()

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

Write configuration data of this object to TokenWriter.

The section is hardcoded to "Signature", context is ignored.

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 229 of file cfl_functions.cpp.

◆ Name() [1/2]

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

Set signature name.

Parameters
rName

Reimplemented from faudes::Type.

Definition at line 188 of file cfl_functions.cpp.

◆ Name() [2/2]

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

Return signature name.

Returns
Name

Reimplemented from faudes::Type.

Definition at line 183 of file cfl_functions.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 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.

◆ Size()

int faudes::Signature::Size ( void  ) const

Return number of parameters.

Returns
int

Definition at line 193 of file cfl_functions.cpp.

Member Data Documentation

◆ mName

std::string faudes::Signature::mName
protected

Variable to store name

Definition at line 358 of file cfl_functions.h.

◆ mParameters

std::vector<Parameter> faudes::Signature::mParameters
protected

Vector of Parameter-objects

Definition at line 361 of file cfl_functions.h.


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

libFAUDES 2.33b --- 2025.05.07 --- c++ api documentaion by doxygen