7#ifndef __PHOENIX_FUNCTION_CALL_H__
8#define __PHOENIX_FUNCTION_CALL_H__
21template <
int First,
int Last>
30 void operator()(PLog & log,
bool & isOk, DataStreamIter & iter, T & mContainers)
const{
31 if(First < Last && isOk){
32 auto & value = std::get<First>(mContainers);
33 isOk &= data_message_load(iter, value);
45 void operator()(PLog & log,
bool & isOk, DataStreamIter & iter, T & mContainers)
const{}
56template <
typename R,
typename... T>
58 std::tuple<T...> args = std::tuple<T...>();
59 DataStreamIter iter = (DataStreamIter)input.data();
65 R res = std::apply(func, args);
70 log.getLogError() <<
"phoenix_function_call : cannot deserialise arguments to function of " << input.size() <<
" byte(s)" << std::endl;
82template <
typename... T>
84 std::tuple<T...> args = std::tuple<T...>();
85 DataStreamIter iter = (DataStreamIter)input.data();
91 std::apply(func, args);
96 log.getLogError() <<
"phoenix_function_call : cannot deserialise arguments to function of " << input.size() <<
" byte(s)" << std::endl;
Basic Data exchanged in the swarm.
void setType(const PString &type)
Sets the type of the Data.
Data phoenix_createData(const T &value)
Create a Data from a value.
bool phoenix_function_call(PLog &log, Data &result, const DataStreamMsg &input, R(*func)(T...))
Call the function with message.
void operator()(PLog &log, bool &isOk, DataStreamIter &iter, T &mContainers) const
Iterate over function parameters.
void operator()(PLog &log, bool &isOk, DataStreamIter &iter, T &mContainers) const
Deserialise the message in the tuple.