PhoenixSwarm
5.2.0
Library to ease communication between daemons
Toggle main menu visibility
Loading...
Searching...
No Matches
phoenix_createData_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 __PHOENIX_CREATEDATA_IMPL_H__
8
#define __PHOENIX_CREATEDATA_IMPL_H__
9
10
#include "phoenix_type_stream.h"
11
#include "phoenix_assert.h"
12
13
#include "
phoenix_createData.h
"
14
16
19
template
<
typename
T>
20
Swarm::Data
phoenix_createData
(
const
T & value){
21
Swarm::Data
param;
22
param.
setType
(phoenix_getTypeToStr<T>());
23
param.
getValue
().resize(data_size(value));
24
DataStreamIter iter = (DataStreamIter)param.
getValue
().data();
25
phoenix_assert(data_message_save(iter, value));
26
return
param;
27
}
28
30
33
template
<
typename
T>
34
T
phoenix_getValueFromData
(
const
Swarm::Data
& data){
35
phoenix_assert(data.
getType
() == phoenix_getTypeToStr<T>());
36
DataStreamIter resIter = (DataStreamIter)data.
getValue
().data();
37
T resValue;
38
phoenix_assert(data_message_load(resIter, resValue));
39
return
resValue;
40
}
41
42
43
#endif
44
Swarm::Data
Basic Data exchanged in the swarm.
Definition
Representation.h:22
Swarm::Data::setType
void setType(const PString &type)
Sets the type of the Data.
Definition
Representation.cpp:80
Swarm::Data::getType
const PString & getType() const
Gets the type of the Data.
Definition
Representation.cpp:122
Swarm::Data::getValue
const DataStreamMsg & getValue() const
Gets the value of the Data.
Definition
Representation.cpp:136
phoenix_createData.h
phoenix_getValueFromData
T phoenix_getValueFromData(const Swarm::Data &data)
Get the value in the Data.
Definition
phoenix_createData_impl.h:34
phoenix_createData
Swarm::Data phoenix_createData(const T &value)
Create a Data from a value.
Definition
phoenix_createData_impl.h:20
src
Representation
phoenix_createData_impl.h
Generated by
1.17.0