forked from eProsima/Fast-DDS-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FastDDSGenCodeTester.cpp
186 lines (157 loc) · 3.09 KB
/
FastDDSGenCodeTester.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
#include <stdint.h>
#include <string>
#include <bitset>
#include <fastcdr/xcdr/optional.hpp>
using octet = unsigned char;
// STRUCTURES_DATA_TYPE
class Structure
{
public:
Structure();
~Structure();
Structure(
const Structure& x);
Structure(
Structure&& x);
Structure& operator =(
const Structure& x);
Structure& operator =(
Structure&& x);
void octet_value(
uint8_t _octet_value);
uint8_t octet_value() const;
uint8_t& octet_value();
void long_value(
int64_t _long_value);
int64_t long_value() const;
int64_t& long_value();
void string_value(
const std::string
& _string_value);
void string_value(
std::string&& _string_value);
const std::string& string_value() const;
std::string& string_value();
private:
uint8_t m_octet_value;
int64_t m_long_value;
std::string m_string_value;
};
//!
// STRUCTURE_INHERITANCE
class ParentStruct
{
octet parent_member;
};
class ChildStruct : public ParentStruct
{
long child_member;
};
//!
// STRUCTURE_WITH_OPTIONAL
class StructWithOptionalMember
{
eprosima::fastcdr::optional<octet> octet_opt;
};
//!
void accessing_optional_value()
{
eprosima::fastcdr::optional<octet> octet_opt;
// ACCESSING_OPTIONAL_VALUE
if (octet_opt.has_value())
{
octet oc = octet_opt.value();
}
//!
}
// UNION_DATA_TYPE
class Union
{
public:
Union();
~Union();
Union(
const Union& x);
Union(
Union&& x);
Union& operator =(
const Union& x);
Union& operator =(
Union&& x);
void d(
int32_t __d);
int32_t _d() const;
int32_t& _d();
void octet_value(
uint8_t _octet_value);
uint8_t octet_value() const;
uint8_t& octet_value();
void long_value(
int64_t _long_value);
int64_t long_value() const;
int64_t& long_value();
void string_value(
const std::string
& _string_value);
void string_value(
std:: string&& _string_value);
const std::string& string_value() const;
std::string& string_value();
private:
int32_t m__d;
uint8_t m_octet_value;
int64_t m_long_value;
std::string m_string_value;
};
//!
// BITSET_DATA_TYPE
class MyBitset
{
public:
void a(
char _a);
char a() const;
void b(
uint16_t _b);
uint16_t b() const;
void c(
int32_t _c);
int32_t c() const;
private:
std::bitset<25> m_bitset;
};
//!
// BITSET_INHERITANCE
class ParentBitset
{
std::bitset<3> parent_member;
};
class ChildBitset : public ParentBitset
{
std::bitset<10> child_member;
};
//!
// ENUMERATION_DATA_TYPE
enum Enumeration : uint32_t
{
RED,
GREEN,
BLUE
};
//!
// BITMASK_DATA_TYPE
enum MyBitMask : uint8_t
{
flag0 = 0x01 << 0,
flag1 = 0x01 << 1,
flag4 = 0x01 << 4,
flag6 = 0x01 << 6,
flag7 = 0x01 << 7
};
//!
/*
// INCLUDE_MORE_IDL_FILES
#include "OtherFile.idl"
#include <AnotherFile.idl>
//!
/**/