PhoenixSwarm  5.1.1
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
12using namespace Swarm;
13
15
19template<typename _Class, typename _Data>
20DataFunctionClassCall<_Class, _Data>::DataFunctionClassCall(PUncastableBool (*function)(_Class&, const _Data &), _Class& persistentData, const PString & name)
21 //:DataFunctionCall<_Data>(nullptr, name),
23 p_persistentData(persistentData),
24 p_function(function)
25{
27}
28
30template<typename _Class, typename _Data>
34
36
40template<typename _Class, typename _Data>
41bool DataFunctionClassCall<_Class, _Data>::call(PLog & log, const Data & data){
42 _Data value(phoenix_getValueFromData<_Data>(data));
43 if(p_function(p_persistentData, value) == UNCASTABLE_TRUE){
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}
51
53template<typename _Class, typename _Data>
57
58
59#endif
60
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.
void initialisationDataFunctionClassCall()
Initialisation function of the class DataFunctionClassCall.
virtual ~DataFunctionClassCall()
Destructor of DataFunctionClassCall.
PUncastableBool(* p_function)(_Class &, const _Data &)
Callable function of the DataFunctionClassCall.
virtual bool call(PLog &log, const Data &data)
Call the function with parameter.
_Class & p_persistentData
Persistent data of the function.
DataFunctionClassCall(PUncastableBool(*function)(_Class &, const _Data &), _Class &persistentData, const PString &name)
Default constructor of DataFunctionClassCall.
Basic Data exchanged in the swarm.
T phoenix_getValueFromData(const Swarm::Data &data)
Get the value in the Data.