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.

#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)
 
Typeoperator= (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 TypeNewCpy (void) const
 
virtual const TypeCast (const Type *pOther) const
 
virtual bool IsDefault (void) const
 
virtual TypeCopy (const Type &rSrc)
 
virtual TypeMove (Type &rSrc)
 
Typeoperator= (const Type &rSrc)
 
Typeoperator= (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 DoCopy (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 DoCopy (const Type &rSrc)
 
void DoMove (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
 

Constructor & Destructor Documentation

◆ Signature() [1/2]

faudes::Signature::Signature ( void  )

Constructor

Definition at line 152 of file cfl_functions.cpp.

◆ Signature() [2/2]

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

Copy constructor

Definition at line 155 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 223 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 199 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 211 of file cfl_functions.cpp.

◆ Clear()

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

Clear signature

Reimplemented from faudes::Type.

Definition at line 177 of file cfl_functions.cpp.

◆ DoCopy()

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

Std faudes type interface: assignment.

Parameters
rSrcSource to copy from

Definition at line 161 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 168 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 259 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 230 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 189 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 184 of file cfl_functions.cpp.

◆ operator!=()

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

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

This operator calls 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 434 of file cfl_types.cpp.

◆ operator=() [1/2]

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

Copy configuration data from other object. Derived classes should implement at least the signature with matching source and destination types via the DoCopy method. Additionally, one may implement variants with a base class as source, as mong as meaningul assigment is possible.

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

◆ operator=() [2/2]

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

Copy configuration data from other object (destructive) Derived classes should implement at least the signature with matching source and destination types via the DoCopy method. Additionally, one may implement variants with a base class as source, as mong as meaningul assigment is possible.

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 383 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 operator calls 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 418 of file cfl_types.cpp.

◆ Size()

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

Return number of parameters.

Returns
int

Definition at line 194 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.34e --- 2026.03.16 --- c++ api documentaion by doxygen