PhoenixSwarm  3.5.0
Library to ease communication between daemons
Loading...
Searching...
No Matches
DataFunctionCall< _Data > Class Template Reference

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

#include <DataFunctionCall.h>

+ Inheritance diagram for DataFunctionCall< _Data >:
+ Collaboration diagram for DataFunctionCall< _Data >:

Public Member Functions

virtual bool call (PLog &log, const Data &data)
 Call the function with parameter.
 
 DataFunctionCall (PUncastableBool(*function)(const _Data &), const PString &name)
 Default constructor of DataFunctionCall.
 
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 ~DataFunctionCall ()
 Destructor of DataFunctionCall.
 

Protected Member Functions

void initialisationDataFunctionCall ()
 Initialisation function of the class DataFunctionCall.
 

Protected Attributes

PUncastableBool(* p_function )(const _Data &)
 Callable function of the DataFunctionCall.
 

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 _Data>
class DataFunctionCall< _Data >

Function which can be called in a Daemon.

Definition at line 14 of file DataFunctionCall.h.

Constructor & Destructor Documentation

◆ DataFunctionCall()

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

Default constructor of DataFunctionCall.

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

Definition at line 19 of file DataFunctionCall_impl.h.

21{
22 //The prototype is compose only of the given data which is normal for dispatching
25}
void setPrototype(const PString &prototype)
Set the prototype of the current function.
AbstractDataFunction(const PString &name)
Default constructor of AbstractDataFunction.
Function which can be called in a Daemon.
PUncastableBool(* p_function)(const _Data &)
Callable function of the DataFunctionCall.
void initialisationDataFunctionCall()
Initialisation function of the class DataFunctionCall.

References AbstractDataFunction::AbstractDataFunction(), initialisationDataFunctionCall(), p_function, and AbstractDataFunction::setPrototype().

+ Here is the call graph for this function:

◆ ~DataFunctionCall()

template<typename _Data>
DataFunctionCall< _Data >::~DataFunctionCall ( )
virtual

Destructor of DataFunctionCall.

Definition at line 29 of file DataFunctionCall_impl.h.

29 {
30
31}

Member Function Documentation

◆ call()

template<typename _Data>
bool DataFunctionCall< _Data >::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 AbstractDataFunction.

Definition at line 39 of file DataFunctionCall_impl.h.

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

References AbstractDataFunction::getName(), AbstractDataFunction::getPrototype(), p_function, 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 34 of file AbstractDataFunction.cpp.

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

References p_name.

Referenced by DataFunctionCall< _Data >::call(), and 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 48 of file AbstractDataFunction.cpp.

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

References p_prototype.

Referenced by DataFunctionCall< _Data >::call(), and 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 55 of file AbstractDataFunction.cpp.

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

References p_name, and p_prototype.

Referenced by AbstractDataFunction().

+ Here is the caller graph for this function:

◆ initialisationDataFunctionCall()

template<typename _Data>
void DataFunctionCall< _Data >::initialisationDataFunctionCall ( )
protected

Initialisation function of the class DataFunctionCall.

Definition at line 52 of file DataFunctionCall_impl.h.

52 {
53
54}

Referenced by DataFunctionCall().

+ 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 27 of file AbstractDataFunction.cpp.

27 {
28 p_name = name;
29}

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 41 of file AbstractDataFunction.cpp.

41 {
42 p_prototype = prototype;
43}

References p_prototype.

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

+ Here is the caller graph for this function:

Member Data Documentation

◆ p_function

template<typename _Data>
PUncastableBool(* DataFunctionCall< _Data >::p_function) (const _Data &)
protected

Callable function of the DataFunctionCall.

Definition at line 25 of file DataFunctionCall.h.

Referenced by call(), and DataFunctionCall().

◆ p_name

PString AbstractDataFunction::p_name
privateinherited

Name of the function.

Definition at line 32 of file AbstractDataFunction.h.

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

◆ p_prototype

PString AbstractDataFunction::p_prototype
privateinherited

Prototype of the function.

Definition at line 34 of file AbstractDataFunction.h.

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


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