PhoenixSwarm  3.5.0
Library to ease communication between daemons
Loading...
Searching...
No Matches
DataFunctionClassCall_impl.h
Go to the documentation of this file.
1/***************************************
2 Auteur : Pierre Aubert
3 Mail : pierre.aubert@lapp.in2p3.fr
4 Licence : CeCILL-C
5****************************************/
6
7#ifndef __DATA_FUNCTION_CLASS_CALL_H_IMPL__
8#define __DATA_FUNCTION_CLASS_CALL_H_IMPL__
9
11
13
17template<typename _Class, typename _Data>
18DataFunctionClassCall<_Class, _Data>::DataFunctionClassCall(PUncastableBool (*function)(_Class&, const _Data &), _Class& persistentData, const PString & name)
19 //:DataFunctionCall<_Data>(nullptr, name),
21 p_persistentData(persistentData),
22 p_function(function)
23{
25}
26
28template<typename _Class, typename _Data>
32
34
38template<typename _Class, typename _Data>
39bool DataFunctionClassCall<_Class, _Data>::call(PLog & log, const Data & data){
40 _Data value(phoenix_getValueFromData<_Data>(data));
41 if(p_function(p_persistentData, value) == UNCASTABLE_TRUE){
42 log.getLogDebug() << "DataFunctionClassCall<_Data>::call : function 'bool '"<<getName()<<"(const "<<getPrototype()<<" &) success" << std::endl;
43 return true;
44 }else{
45 log.getLogError() << "DataFunctionClassCall<_Data>::call : function 'bool '"<<getName()<<"(const "<<getPrototype()<<" &) failed" << std::endl;
46 return false;
47 }
48}
49
51template<typename _Class, typename _Data>
55
56
57#endif
58
const PString & getPrototype() const
Get the prototype of the current function.
const PString & getName() const
Name of the function.
AbstractDataFunction(const PString &name)
Default constructor of AbstractDataFunction.
PUncastableBool(* p_function)(_Class &, const _Data &)
Callable function of the DataFunctionClassCall.
DataFunctionClassCall(PUncastableBool(*function)(_Class &, const _Data &), _Class &persistentData, const PString &name)
Default constructor of DataFunctionClassCall.
virtual bool call(PLog &log, const Data &data)
Call the function with parameter.
void initialisationDataFunctionClassCall()
Initialisation function of the class DataFunctionClassCall.
virtual ~DataFunctionClassCall()
Destructor of DataFunctionClassCall.
_Class & p_persistentData
Persistent data of the function.
Basic Data exchanged in the swarm.
T phoenix_getValueFromData(const Data &data)
Get the value in the Data.