PhoenixPresentation  2.0.0
Set of cmake function to automate presentation generation
main.cpp
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 #include "phoenix_data_stream.h"
8 
9 namespace ShadokType{
11  enum ShadokType{
12  NONE = 0, //Nothing to do
13  HAUT = 1, //Shadok from the top of the planet
14  BAS = 2 //Shadok from the bottom of the planet
15  };
16 }
18 
19 void testShadokTypeSize(){
22  size_t shadokSize(data_size(type));
23  data_stream_assert(checkValue("testShadokTypeSize", shadokSize, 4lu));
24 }
25 
29 
30  DataStreamMsg messageIn(data_size(type));
31  DataStreamIter iter = (DataStreamIter)messageIn.data();
33 
36  DataStreamIter iterOut = (DataStreamIter)messageIn.data();
38 
39  data_stream_assert(checkValue("testShadokMessage", out, type));
40 }
41 
45  std::string fileName("ShadokType.data");
46  data_save(fileName, type);
47 
50  data_load(fileName, out);
51 
52  data_stream_assert(checkValue("testShadokFile", out, type));
53 }
54 
55 
56 int main(int argc, char** argv){
60  return 0;
61 }
62 
int main(int argc, char **argv)
Definition: main.cpp:228
void testShadokTypeFile()
Test the Shadok message.
Definition: main.cpp:74
void testShadokTypeMessage()
Test the Shadok message.
Definition: main.cpp:58
void testShadokTypeSize()
Test the Shadok size.
Definition: main.cpp:51
bool data_load(FILE *iter, T &data)
Load data from a message.
Definition: data_file.h:39
bool data_save(FILE *iter, const T &data)
Save data in a message.
Definition: data_file.h:18
bool data_message_save(DataStreamIter &iter, T &data)
Save data in a message.
Definition: data_message.h:18
bool data_message_load(DataStreamIter &iter, T &data)
Load data from a message.
Definition: data_message.h:60
size_t data_size(T &data)
Get size of data.
Definition: data_size.h:17
#define data_stream_assert(isOk)
bool checkValue(const std::string &testName, const T &givenSize, const T &referenceSize)
Check given value compare to the reference value.
#define PHOENIX_DATA_STREAM_ENUM(X)
Macro which allows to simply integrate enum types into Data Stream workflow.
std::vector< DataStreamType > DataStreamMsg
DataStreamType * DataStreamIter
ShadokType
Type of the Shadok we want to serialized.
Definition: main.cpp:12
@ HAUT
Definition: main.cpp:14
@ NONE
Definition: main.cpp:13