PhoenixSwarm  5.1.1
Library to ease communication between daemons
Loading...
Searching...
No Matches
Swarm::DataFunctionClassCall< _Class, _Data > Class Template Reference

Function which can be called in a Daemon. More...

#include <DataFunctionClassCall.h>

+ Inheritance diagram for Swarm::DataFunctionClassCall< _Class, _Data >:
+ Collaboration diagram for Swarm::DataFunctionClassCall< _Class, _Data >:

Public Member Functions

virtual bool call (PLog &log, const Data &data)
 Call the function with parameter.
 
 DataFunctionClassCall (PUncastableBool(*function)(_Class &, const _Data &), _Class &persistentData, const PString &name)
 Default constructor of DataFunctionClassCall.
 
const PString & getName () const
 Name of the function.
 
const PString & getPrototype () const
 Get the prototype of the current function.
 
void setName (const PString &name)
 Set the name of the function.
 
void setPrototype (const PString &prototype)
 Set the prototype of the current function.
 
virtual ~DataFunctionClassCall ()
 Destructor of DataFunctionClassCall.
 

Protected Member Functions

void initialisationDataFunctionClassCall ()
 Initialisation function of the class DataFunctionClassCall.
 

Protected Attributes

PUncastableBool(* p_function )(_Class &, const _Data &)
 Callable function of the DataFunctionClassCall.
 
_Class & p_persistentData
 Persistent data of the function.
 

Private Member Functions

void initialisationAbstractDataFunction (const PString &name)
 Initialisation function of the class AbstractDataFunction.
 

Private Attributes

PString p_name
 Name of the function.
 
PString p_prototype
 Prototype of the function.
 

Detailed Description

template<typename _Class, typename _Data>
class Swarm::DataFunctionClassCall< _Class, _Data >

Function which can be called in a Daemon.

Definition at line 14 of file DataFunctionClassCall.h.

Constructor & Destructor Documentation

◆ DataFunctionClassCall()

template<typename _Class, typename _Data>
DataFunctionClassCall::DataFunctionClassCall ( PUncastableBool(* function )(_Class &, const _Data &),
_Class & persistentData,
const PString & name )

Default constructor of DataFunctionClassCall.

Parameters
function: function to be called on a given data
persistentData: persistent data of the function to be called
name: name of the function

Definition at line 20 of file DataFunctionClassCall_impl.h.

25{
27}
AbstractDataFunction(const PString &name)
Default constructor of AbstractDataFunction.
Function which can be called in a Daemon.
void initialisationDataFunctionClassCall()
Initialisation function of the class DataFunctionClassCall.
PUncastableBool(* p_function)(_Class &, const _Data &)
Callable function of the DataFunctionClassCall.
_Class & p_persistentData
Persistent data of the function.

References Swarm::AbstractDataFunction::AbstractDataFunction(), initialisationDataFunctionClassCall(), p_function, and p_persistentData.

+ Here is the call graph for this function:

◆ ~DataFunctionClassCall()

template<typename _Class, typename _Data>
DataFunctionClassCall::~DataFunctionClassCall ( )
virtual

Destructor of DataFunctionClassCall.

Definition at line 31 of file DataFunctionClassCall_impl.h.

31 {
32
33}

Member Function Documentation

◆ call()

template<typename _Class, typename _Data>
bool DataFunctionClassCall::call ( PLog & log,
const Data & data )
virtual

Call the function with parameter.

Parameters
[out]log: logger
data: data given to the function
Returns
true on success, false otherwise

Implements Swarm::AbstractDataFunction.

Definition at line 41 of file DataFunctionClassCall_impl.h.

41 {
44 log.getLogDebug() << "DataFunctionClassCall<_Data>::call : function 'bool '"<<getName()<<"(const "<<getPrototype()<<" &) success" << std::endl;
45 return true;
46 }else{
47 log.getLogError() << "DataFunctionClassCall<_Data>::call : function 'bool '"<<getName()<<"(const "<<getPrototype()<<" &) failed" << std::endl;
48 return false;
49 }
50}
const PString & getPrototype() const
Get the prototype of the current function.
const PString & getName() const
Name of the function.

References Swarm::AbstractDataFunction::getName(), Swarm::AbstractDataFunction::getPrototype(), p_function, p_persistentData, and phoenix_getValueFromData().

+ Here is the call graph for this function:

◆ getName()

const PString & AbstractDataFunction::getName ( ) const
inherited

Name of the function.

Returns
name of the function

Definition at line 33 of file AbstractDataFunction.cpp.

33 {
34 return p_name;
35}
PString p_name
Name of the function.

References p_name.

Referenced by Swarm::DataFunctionCall< _Data >::call(), and Swarm::DataFunctionClassCall< _Class, _Data >::call().

+ Here is the caller graph for this function:

◆ getPrototype()

const PString & AbstractDataFunction::getPrototype ( ) const
inherited

Get the prototype of the current function.

Returns
prototype of the current function

Definition at line 47 of file AbstractDataFunction.cpp.

47 {
48 return p_prototype;
49}
PString p_prototype
Prototype of the function.

References p_prototype.

Referenced by Swarm::DataFunctionCall< _Data >::call(), and Swarm::DataFunctionClassCall< _Class, _Data >::call().

+ Here is the caller graph for this function:

◆ initialisationAbstractDataFunction()

void AbstractDataFunction::initialisationAbstractDataFunction ( const PString & name)
privateinherited

Initialisation function of the class AbstractDataFunction.

Parameters
name: name of the function

Definition at line 54 of file AbstractDataFunction.cpp.

54 {
55 p_name = name;
56 p_prototype = name;
57}

References p_name, and p_prototype.

Referenced by AbstractDataFunction().

+ Here is the caller graph for this function:

◆ initialisationDataFunctionClassCall()

template<typename _Class, typename _Data>
void DataFunctionClassCall::initialisationDataFunctionClassCall ( )
protected

Initialisation function of the class DataFunctionClassCall.

Definition at line 54 of file DataFunctionClassCall_impl.h.

54 {
55
56}

Referenced by DataFunctionClassCall().

+ Here is the caller graph for this function:

◆ setName()

void AbstractDataFunction::setName ( const PString & name)
inherited

Set the name of the function.

Parameters
name: name of the function

Definition at line 26 of file AbstractDataFunction.cpp.

26 {
27 p_name = name;
28}

References p_name.

◆ setPrototype()

void AbstractDataFunction::setPrototype ( const PString & prototype)
inherited

Set the prototype of the current function.

Parameters
prototype: prototype of the current function

Definition at line 40 of file AbstractDataFunction.cpp.

40 {
41 p_prototype = prototype;
42}

References p_prototype.

Referenced by Swarm::DataFunctionCall< _Data >::DataFunctionCall().

+ Here is the caller graph for this function:

Member Data Documentation

◆ p_function

template<typename _Class, typename _Data>
PUncastableBool(* Swarm::DataFunctionClassCall< _Class, _Data >::p_function) (_Class &, const _Data &)
protected

Callable function of the DataFunctionClassCall.

Definition at line 27 of file DataFunctionClassCall.h.

Referenced by call(), and DataFunctionClassCall().

◆ p_name

PString Swarm::AbstractDataFunction::p_name
privateinherited

Name of the function.

Definition at line 33 of file AbstractDataFunction.h.

Referenced by getName(), initialisationAbstractDataFunction(), and setName().

◆ p_persistentData

template<typename _Class, typename _Data>
_Class& Swarm::DataFunctionClassCall< _Class, _Data >::p_persistentData
protected

Persistent data of the function.

Definition at line 25 of file DataFunctionClassCall.h.

Referenced by call(), and DataFunctionClassCall().

◆ p_prototype

PString Swarm::AbstractDataFunction::p_prototype
privateinherited

Prototype of the function.

Definition at line 35 of file AbstractDataFunction.h.

Referenced by getPrototype(), initialisationAbstractDataFunction(), and setPrototype().


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