PhoenixSwarm
5.2.0
Library to ease communication between daemons
Toggle main menu visibility
Loading...
Searching...
No Matches
DataFunctionCall_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_CALL_H_IMPL__
8
#define __DATA_FUNCTION_CALL_H_IMPL__
9
10
#include "phoenix_type_stream.h"
11
#include "
DataFunctionCall.h
"
12
#include "
phoenix_function_call.h
"
13
14
using namespace
Swarm
;
15
17
20
template
<
typename
_Data>
21
DataFunctionCall<_Data>::DataFunctionCall
(PUncastableBool (*function)(
const
_Data &),
const
PString & name)
22
:
AbstractDataFunction
(name),
p_function
(function)
23
{
24
//The prototype is compose only of the given data which is normal for dispatching
25
setPrototype
(phoenix_getTypeToStr<_Data>());
26
initialisationDataFunctionCall
();
27
}
28
30
template
<
typename
_Data>
31
DataFunctionCall<_Data>::~DataFunctionCall
(){
32
33
}
34
36
40
template
<
typename
_Data>
41
bool
DataFunctionCall<_Data>::call
(PLog & log,
const
Data
& data){
42
_Data value(
phoenix_getValueFromData<_Data>
(data));
43
if
(
p_function
(value) == UNCASTABLE_TRUE){
44
log.getLogDebug() <<
"DataFunctionCall<_Data>::call : function 'bool '"
<<
getName
()<<
"(const "
<<
getPrototype
()<<
" &) success"
<< std::endl;
45
return
true
;
46
}
else
{
47
log.getLogError() <<
"DataFunctionCall<_Data>::call : function 'bool '"
<<
getName
()<<
"(const "
<<
getPrototype
()<<
" &) failed"
<< std::endl;
48
return
false
;
49
}
50
}
51
53
template
<
typename
_Data>
54
void
DataFunctionCall<_Data>::initialisationDataFunctionCall
(){
55
56
}
57
58
59
60
61
62
#endif
63
64
65
DataFunctionCall.h
Swarm::AbstractDataFunction::getPrototype
const PString & getPrototype() const
Get the prototype of the current function.
Definition
AbstractDataFunction.cpp:47
Swarm::AbstractDataFunction::setPrototype
void setPrototype(const PString &prototype)
Set the prototype of the current function.
Definition
AbstractDataFunction.cpp:40
Swarm::AbstractDataFunction::getName
const PString & getName() const
Name of the function.
Definition
AbstractDataFunction.cpp:33
Swarm::AbstractDataFunction::AbstractDataFunction
AbstractDataFunction(const PString &name)
Default constructor of AbstractDataFunction.
Definition
AbstractDataFunction.cpp:14
Swarm::DataFunctionCall::DataFunctionCall
DataFunctionCall(PUncastableBool(*function)(const _Data &), const PString &name)
Default constructor of DataFunctionCall.
Definition
DataFunctionCall_impl.h:21
Swarm::DataFunctionCall::call
virtual bool call(PLog &log, const Swarm::Data &data)
Call the function with parameter.
Definition
DataFunctionCall_impl.h:41
Swarm::DataFunctionCall::initialisationDataFunctionCall
void initialisationDataFunctionCall()
Initialisation function of the class DataFunctionCall.
Definition
DataFunctionCall_impl.h:54
Swarm::DataFunctionCall::~DataFunctionCall
virtual ~DataFunctionCall()
Destructor of DataFunctionCall.
Definition
DataFunctionCall_impl.h:31
Swarm::DataFunctionCall::p_function
PUncastableBool(* p_function)(const _Data &)
Callable function of the DataFunctionCall.
Definition
DataFunctionCall.h:25
Swarm::Data
Basic Data exchanged in the swarm.
Definition
Representation.h:22
Swarm
Definition
StatSort.h:12
phoenix_getValueFromData
T phoenix_getValueFromData(const Swarm::Data &data)
Get the value in the Data.
Definition
phoenix_createData_impl.h:34
phoenix_function_call.h
src
Function
DataFunctionCall_impl.h
Generated by
1.17.0