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
}
17
PHOENIX_DATA_STREAM_ENUM
(
ShadokType::ShadokType
)
18
19
void
testShadokTypeSize
(){
21
ShadokType::ShadokType
type(
ShadokType::HAUT
);
22
size_t
shadokSize(
data_size
(type));
23
data_stream_assert
(
checkValue
(
"testShadokTypeSize"
, shadokSize, 4lu));
24
}
25
27
void
testShadokTypeMessage
(){
28
ShadokType::ShadokType
type(
ShadokType::BAS
);
29
30
DataStreamMsg
messageIn(
data_size
(type));
31
DataStreamIter
iter = (
DataStreamIter
)messageIn.data();
32
data_stream_assert
(
data_message_save
(iter, type));
33
35
ShadokType::ShadokType
out;
36
DataStreamIter
iterOut = (
DataStreamIter
)messageIn.data();
37
data_stream_assert
(
data_message_load
(iterOut, out));
38
39
data_stream_assert
(
checkValue
(
"testShadokMessage"
, out, type));
40
}
41
43
void
testShadokTypeFile
(){
44
ShadokType::ShadokType
type(
ShadokType::BAS
);
45
std::string fileName(
"ShadokType.data"
);
46
data_save
(fileName, type);
47
49
ShadokType::ShadokType
out;
50
data_load
(fileName, out);
51
52
data_stream_assert
(
checkValue
(
"testShadokFile"
, out, type));
53
}
54
55
56
int
main
(
int
argc,
char
** argv){
57
testShadokTypeSize
();
58
testShadokTypeMessage
();
59
testShadokTypeFile
();
60
return
0;
61
}
62
main
int main(int argc, char **argv)
Definition:
main.cpp:228
testShadokTypeFile
void testShadokTypeFile()
Test the Shadok message.
Definition:
main.cpp:74
testShadokTypeMessage
void testShadokTypeMessage()
Test the Shadok message.
Definition:
main.cpp:58
testShadokTypeSize
void testShadokTypeSize()
Test the Shadok size.
Definition:
main.cpp:51
data_load
bool data_load(FILE *iter, T &data)
Load data from a message.
Definition:
data_file.h:39
data_save
bool data_save(FILE *iter, const T &data)
Save data in a message.
Definition:
data_file.h:18
data_message_save
bool data_message_save(DataStreamIter &iter, T &data)
Save data in a message.
Definition:
data_message.h:18
data_message_load
bool data_message_load(DataStreamIter &iter, T &data)
Load data from a message.
Definition:
data_message.h:60
data_size
size_t data_size(T &data)
Get size of data.
Definition:
data_size.h:17
data_stream_assert
#define data_stream_assert(isOk)
Definition:
data_stream_assert.h:17
checkValue
bool checkValue(const std::string &testName, const T &givenSize, const T &referenceSize)
Check given value compare to the reference value.
Definition:
data_stream_check_value_impl.h:19
PHOENIX_DATA_STREAM_ENUM
#define PHOENIX_DATA_STREAM_ENUM(X)
Macro which allows to simply integrate enum types into Data Stream workflow.
Definition:
data_stream_enum.h:13
DataStreamMsg
std::vector< DataStreamType > DataStreamMsg
Definition:
data_stream_include.h:27
DataStreamIter
DataStreamType * DataStreamIter
Definition:
data_stream_include.h:28
ShadokType
Definition:
main.cpp:10
ShadokType::ShadokType
ShadokType
Type of the Shadok we want to serialized.
Definition:
main.cpp:12
ShadokType::HAUT
@ HAUT
Definition:
main.cpp:14
ShadokType::BAS
@ BAS
Definition:
main.cpp:15
ShadokType::NONE
@ NONE
Definition:
main.cpp:13
phoenix_data_stream.h
tmp_project
PhoenixInkscape
tmp_project
PhoenixDataStream
TESTS
TEST_ENUM_MACRO
main.cpp
Generated on Fri Mar 14 2025 15:50:10 for PhoenixPresentation by
1.9.1