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"/>
Signature(void)
Constructor.

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)
 Constructor. More...
 
 Signature (const Signature &rSrc)
 Copy constructor. More...
 
 ~Signature (void)
 Destructor. More...
 
const std::string & Name (void) const
 Return signature name. More...
 
void Name (const std::string &rName)
 Set signature name. More...
 
void Clear (void)
 Clear signature. More...
 
int Size (void) const
 Return number of parameters. More...
 
const ParameterAt (int n) const
 Get parameter type by position. More...
 
void At (int n, const Parameter &rParam)
 Set parameter type by position. More...
 
void Append (const Parameter &rParam)
 Append positional parameter. 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...
 
virtual Typeoperator= (const Type &rSrc)
 Assign configurationdata from other object. More...
 
virtual bool Equal (const Type &rOther) const
 Test equality of configuration data. More...
 
virtual bool operator== (const Type &rOther) const
 Test equality of configuration data. More...
 
virtual bool operator!= (const Type &rOther) const
 Test equality of configuration data. 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 Signature &rSrc)
 Std faudes type interface: assignment. More...
 
bool DoEqual (const Signature &rOther) const
 Std faudes type interface: test equality. More...
 
virtual void DoRead (TokenReader &rTr, const std::string &rLabel="", const Type *pContext=0)
 Read signature from 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...
 
- 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 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
 

Protected Attributes

std::string mName
 Variable to store name. More...
 
std::vector< ParametermParameters
 Vector of Parameter-objects. More...
 

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 234 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
Returns
Reference to this object.

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.

◆ 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 355 of file cfl_functions.h.

◆ mParameters

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

Vector of Parameter-objects.

Definition at line 358 of file cfl_functions.h.


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

libFAUDES 2.32b --- 2024.03.01 --- c++ api documentaion by doxygen