PhoenixPresentation  2.0.0
Set of cmake function to automate presentation generation
main.cpp File Reference
+ Include dependency graph for main.cpp:

Go to the source code of this file.

Functions

template<typename T >
void checkMapDataMessage (const std::string &nameOfType)
 Check the list of data with message of a given type. More...
 
int main (int argc, char **argv)
 
void testMapDataMessage ()
 Test if data size is Ok. More...
 

Function Documentation

◆ checkMapDataMessage()

template<typename T >
void checkMapDataMessage ( const std::string &  nameOfType)

Check the list of data with message of a given type.

Parameters
nameOfType: name of the type to be checked assert on fail

Definition at line 17 of file main.cpp.

17  {
18  size_t nbValue(10lu);
19 
20  std::map<T, T> vecData;
21  for(size_t i(0lu); i < nbValue; ++i){vecData[i] = 2lu*i;}
22 
23  DataStreamMsg message(data_size(vecData));
24  //Put data in message
25  DataStreamIter iter = (DataStreamIter)message.data();
26  data_stream_assert(data_message_save(iter, vecData)); //Save the message
27  DataStreamIter loadIter = (DataStreamIter)message.data();
28  std::map<T, T> outVec;
29  data_stream_assert(data_message_load(loadIter, outVec)); //Load the message
30  data_stream_assert(checkValue("std::map<"+nameOfType+", "+nameOfType+">", outVec, vecData));
31 }
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.
std::vector< DataStreamType > DataStreamMsg
DataStreamType * DataStreamIter

References checkValue(), data_message_load(), data_message_save(), data_size(), and data_stream_assert.

+ Here is the call graph for this function:

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 51 of file main.cpp.

51  {
53  return 0;
54 }
void testMapDataMessage()
Test if data size is Ok.
Definition: main.cpp:34

References testMapDataMessage().

+ Here is the call graph for this function:

◆ testMapDataMessage()

void testMapDataMessage ( )

Test if data size is Ok.

Definition at line 34 of file main.cpp.

34  {
35  checkMapDataMessage<long unsigned int>("long unsigned int");
36  checkMapDataMessage<unsigned int>("unsigned int");
37  checkMapDataMessage<unsigned short>("unsigned short");
38  checkMapDataMessage<unsigned int>("unsigned int");
39  checkMapDataMessage<unsigned char>("unsigned char");
40  checkMapDataMessage<long int>("long int");
41  checkMapDataMessage<int>("int");
42  checkMapDataMessage<short>("short");
43  checkMapDataMessage<int>("int");
44  checkMapDataMessage<char>("char");
45  checkMapDataMessage<float>("float");
46  checkMapDataMessage<double>("double");
47  checkMapDataMessage<int8_t>("int8_t");
48 }

Referenced by main().

+ Here is the caller graph for this function: