summaryrefslogtreecommitdiff
path: root/src/test/src-gen/core/commonapi/tests/DerivedTypeCollection.hpp
blob: 90589dc5e43edc527b71683757e73474b7d09df1 (plain)
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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
/*
* This file was generated by the CommonAPI Generators.
* Used org.genivi.commonapi.core 3.1.2.v201507021046.
* Used org.franca.core 0.9.1.201412191134.
*
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
* If a copy of the MPL was not distributed with this file, You can obtain one at
* http://mozilla.org/MPL/2.0/.
*/
#ifndef COMMONAPI_TESTS_Derived_Type_Collection_HPP_
#define COMMONAPI_TESTS_Derived_Type_Collection_HPP_


#include <commonapi/tests/PredefinedTypeCollection.hpp>

#if !defined (COMMONAPI_INTERNAL_COMPILATION)
#define COMMONAPI_INTERNAL_COMPILATION
#endif

#include <CommonAPI/Deployment.hpp>
#include <CommonAPI/InputStream.hpp>
#include <CommonAPI/OutputStream.hpp>
#include <CommonAPI/Struct.hpp>
#include <CommonAPI/Types.hpp>
#include <cstdint>
#include <string>
#include <unordered_map>
#include <vector>

#undef COMMONAPI_INTERNAL_COMPILATION

namespace commonapi {
namespace tests {

struct DerivedTypeCollection {
    struct TestStruct : CommonAPI::Struct<::commonapi::tests::PredefinedTypeCollection::TestString, uint16_t> {
    	
    	TestStruct() {
    	}
    	TestStruct(const ::commonapi::tests::PredefinedTypeCollection::TestString &_testString, const uint16_t &_uintValue)
    	{
    		std::get<0>(values_) = _testString;
    		std::get<1>(values_) = _uintValue;
    	}
    	/**
    	 * description: the name of the property
    	 */
    	inline const ::commonapi::tests::PredefinedTypeCollection::TestString &getTestString() const { return std::get<0>(values_); }
    	inline void setTestString(const ::commonapi::tests::PredefinedTypeCollection::TestString &_value) { std::get<0>(values_) = _value; }
    	/**
    	 * description: the actual value
    	 */
    	inline const uint16_t &getUintValue() const { return std::get<1>(values_); }
    	inline void setUintValue(const uint16_t &_value) { std::get<1>(values_) = _value; }
    	bool operator==(const TestStruct &_other) const;
    	inline bool operator!=(const TestStruct &_other) const {
    		return !((*this) == _other);
    	}
    
    };
    typedef std::vector<TestStruct> TestArrayTestStruct;
    typedef std::unordered_map<uint32_t, ::commonapi::tests::DerivedTypeCollection::TestArrayTestStruct> TestMap;
    /**
     * description: Common errors.
     */
    
    struct TestEnum : CommonAPI::Enumeration<int32_t> {
        enum Literal : int32_t {
            E_UNKNOWN = 0,
            E_OK = 1,
            E_OUT_OF_RANGE = 2,
            E_NOT_USED = 3
        };
        
        TestEnum() = default;
        TestEnum(const Literal &_value) 
            : CommonAPI::Enumeration<int32_t>(static_cast<int32_t>(_value)) {}
    
        inline bool operator==(const TestEnum &_other) const { return (value_ == _other.value_); }
        inline bool operator!=(const TestEnum &_other) const { return (value_ != _other.value_); }
        inline bool operator<=(const TestEnum &_other) const { return (value_ <= _other.value_); }
        inline bool operator>=(const TestEnum &_other) const { return (value_ >= _other.value_); }
        inline bool operator<(const TestEnum &_other) const { return (value_ < _other.value_); }
        inline bool operator>(const TestEnum &_other) const { return (value_ > _other.value_); }
        
        inline bool operator==(const Literal &_value) const { return (value_ == static_cast<int32_t>(_value)); }
        inline bool operator!=(const Literal &_value) const { return (value_ != static_cast<int32_t>(_value)); }
        inline bool operator<=(const Literal &_value) const { return (value_ <= static_cast<int32_t>(_value)); }
        inline bool operator>=(const Literal &_value) const { return (value_ >= static_cast<int32_t>(_value)); }
        inline bool operator<(const Literal &_value) const { return (value_ < static_cast<int32_t>(_value)); }
        inline bool operator>(const Literal &_value) const { return (value_ > static_cast<int32_t>(_value)); }
    };
    
    struct TestEnumExtended : TestEnum {
        enum Literal : int32_t {
            E_NEW = 4
        };
        
        TestEnumExtended() = default;
        TestEnumExtended(const Literal &_value) 
            : TestEnum(static_cast<TestEnum::Literal>(_value)) {}
        TestEnumExtended &operator=(const TestEnum::Literal &_value) {
            value_ = static_cast<int32_t>(_value);
            return (*this);
        }
    
        inline bool operator==(const TestEnumExtended &_other) const { return (value_ == _other.value_); }
        inline bool operator!=(const TestEnumExtended &_other) const { return (value_ != _other.value_); }
        inline bool operator<=(const TestEnumExtended &_other) const { return (value_ <= _other.value_); }
        inline bool operator>=(const TestEnumExtended &_other) const { return (value_ >= _other.value_); }
        inline bool operator<(const TestEnumExtended &_other) const { return (value_ < _other.value_); }
        inline bool operator>(const TestEnumExtended &_other) const { return (value_ > _other.value_); }
        
        inline bool operator==(const Literal &_value) const { return (value_ == static_cast<int32_t>(_value)); }
        inline bool operator!=(const Literal &_value) const { return (value_ != static_cast<int32_t>(_value)); }
        inline bool operator<=(const Literal &_value) const { return (value_ <= static_cast<int32_t>(_value)); }
        inline bool operator>=(const Literal &_value) const { return (value_ >= static_cast<int32_t>(_value)); }
        inline bool operator<(const Literal &_value) const { return (value_ < static_cast<int32_t>(_value)); }
        inline bool operator>(const Literal &_value) const { return (value_ > static_cast<int32_t>(_value)); }
    };
    
    struct TestEnumExtended2 : TestEnumExtended {
        enum Literal : int32_t {
            E_NEW2 = 5
        };
        
        TestEnumExtended2() = default;
        TestEnumExtended2(const Literal &_value) 
            : TestEnumExtended(static_cast<TestEnumExtended::Literal>(_value)) {}
        TestEnumExtended2 &operator=(const TestEnumExtended::Literal &_value) {
            value_ = static_cast<int32_t>(_value);
            return (*this);
        }
        TestEnumExtended &operator=(const TestEnum::Literal &_value) {
            value_ = static_cast<int32_t>(_value);
            return (*this);
        }
    
        inline bool operator==(const TestEnumExtended2 &_other) const { return (value_ == _other.value_); }
        inline bool operator!=(const TestEnumExtended2 &_other) const { return (value_ != _other.value_); }
        inline bool operator<=(const TestEnumExtended2 &_other) const { return (value_ <= _other.value_); }
        inline bool operator>=(const TestEnumExtended2 &_other) const { return (value_ >= _other.value_); }
        inline bool operator<(const TestEnumExtended2 &_other) const { return (value_ < _other.value_); }
        inline bool operator>(const TestEnumExtended2 &_other) const { return (value_ > _other.value_); }
        
        inline bool operator==(const Literal &_value) const { return (value_ == static_cast<int32_t>(_value)); }
        inline bool operator!=(const Literal &_value) const { return (value_ != static_cast<int32_t>(_value)); }
        inline bool operator<=(const Literal &_value) const { return (value_ <= static_cast<int32_t>(_value)); }
        inline bool operator>=(const Literal &_value) const { return (value_ >= static_cast<int32_t>(_value)); }
        inline bool operator<(const Literal &_value) const { return (value_ < static_cast<int32_t>(_value)); }
        inline bool operator>(const Literal &_value) const { return (value_ > static_cast<int32_t>(_value)); }
    };
    struct TestStructExtended : CommonAPI::Struct<::commonapi::tests::PredefinedTypeCollection::TestString, uint16_t, TestEnumExtended2> {
    	
    	TestStructExtended() {
    	}
    	TestStructExtended(const ::commonapi::tests::PredefinedTypeCollection::TestString &_testString, const uint16_t &_uintValue, const TestEnumExtended2 &_testEnumExtended2)
    	{
    		std::get<0>(values_) = _testString;
    		std::get<1>(values_) = _uintValue;
    		std::get<2>(values_) = _testEnumExtended2;
    	}
    	/**
    	 * description: the name of the property
    	 */
    	inline const ::commonapi::tests::PredefinedTypeCollection::TestString &getTestString() const { return std::get<0>(values_); }
    	inline void setTestString(const ::commonapi::tests::PredefinedTypeCollection::TestString &_value) { std::get<0>(values_) = _value; }
    	/**
    	 * description: the actual value
    	 */
    	inline const uint16_t &getUintValue() const { return std::get<1>(values_); }
    	inline void setUintValue(const uint16_t &_value) { std::get<1>(values_) = _value; }
    	inline const TestEnumExtended2 &getTestEnumExtended2() const { return std::get<2>(values_); }
    	inline void setTestEnumExtended2(const TestEnumExtended2 &_value) { std::get<2>(values_) = _value; }
    	bool operator==(const TestStructExtended &_other) const;
    	inline bool operator!=(const TestStructExtended &_other) const {
    		return !((*this) == _other);
    	}
    
    };
    typedef std::unordered_map<::commonapi::tests::DerivedTypeCollection::TestEnum, std::string, CommonAPI::EnumHasher<::commonapi::tests::DerivedTypeCollection::TestEnum>> TestEnumMap;
    
    struct TestEnumMissingValue : CommonAPI::Enumeration<int32_t> {
        enum Literal : int32_t {
            E1 = 0,
            E2 = 1,
            E3 = 2
        };
        
        TestEnumMissingValue() = default;
        TestEnumMissingValue(const Literal &_value) 
            : CommonAPI::Enumeration<int32_t>(static_cast<int32_t>(_value)) {}
    
        inline bool operator==(const TestEnumMissingValue &_other) const { return (value_ == _other.value_); }
        inline bool operator!=(const TestEnumMissingValue &_other) const { return (value_ != _other.value_); }
        inline bool operator<=(const TestEnumMissingValue &_other) const { return (value_ <= _other.value_); }
        inline bool operator>=(const TestEnumMissingValue &_other) const { return (value_ >= _other.value_); }
        inline bool operator<(const TestEnumMissingValue &_other) const { return (value_ < _other.value_); }
        inline bool operator>(const TestEnumMissingValue &_other) const { return (value_ > _other.value_); }
        
        inline bool operator==(const Literal &_value) const { return (value_ == static_cast<int32_t>(_value)); }
        inline bool operator!=(const Literal &_value) const { return (value_ != static_cast<int32_t>(_value)); }
        inline bool operator<=(const Literal &_value) const { return (value_ <= static_cast<int32_t>(_value)); }
        inline bool operator>=(const Literal &_value) const { return (value_ >= static_cast<int32_t>(_value)); }
        inline bool operator<(const Literal &_value) const { return (value_ < static_cast<int32_t>(_value)); }
        inline bool operator>(const Literal &_value) const { return (value_ > static_cast<int32_t>(_value)); }
    };
    typedef std::vector<uint64_t> TestArrayUInt64;
    static const CommonAPI::Serial TESTPOLYMORPHICSTRUCT_SERIAL = 0x8F51A326;
    static const CommonAPI::Serial TESTEXTENDEDPOLYMORPHICSTRUCT_SERIAL = 0xA49310F2;
    
    struct TestPolymorphicStruct : CommonAPI::PolymorphicStruct {
    	static std::shared_ptr<TestPolymorphicStruct> create(CommonAPI::Serial _serial);
    	const CommonAPI::Serial getSerial() const {	return TESTPOLYMORPHICSTRUCT_SERIAL; }
    	
    	TestPolymorphicStruct() {
    	}
    	TestPolymorphicStruct(const ::commonapi::tests::PredefinedTypeCollection::TestString &_testString, const uint16_t &_uintValue)
    	{
    		std::get<0>(values_) = _testString;
    		std::get<1>(values_) = _uintValue;
    	}
    	template<class _Input>
    	void readValue(CommonAPI::InputStream<_Input> &_input, const CommonAPI::EmptyDeployment *_depl) {
    		_input.template readValue<CommonAPI::EmptyDeployment>(std::get<0>(values_));
    		_input.template readValue<CommonAPI::EmptyDeployment>(std::get<1>(values_));
    		switch (getSerial()) {
    		case TESTEXTENDEDPOLYMORPHICSTRUCT_SERIAL:
    			static_cast<TestExtendedPolymorphicStruct *>(this)->template readValue<_Input>(_input, _depl);
    			break;
    		default:
    			break;
    		}
    	}
    
    	template<class _Input, class _Deployment>
    	void readValue(CommonAPI::InputStream<_Input> &_input, const _Deployment *_depl) {
    		_input.template readValue<>(std::get<0>(values_), std::get<0>(_depl->values_));
    		_input.template readValue<>(std::get<1>(values_), std::get<1>(_depl->values_));
    		switch (getSerial()) {
    		case TESTEXTENDEDPOLYMORPHICSTRUCT_SERIAL:
    			static_cast<TestExtendedPolymorphicStruct *>(this)->template readValue<>(_input, _depl);
    			break;
    		default:
    			break;
    		}
    	}
    
    	template<class _Output>
    	void writeType(CommonAPI::TypeOutputStream<_Output> &_output) {
    		_output.writeType(std::get<0>(values_));
    		_output.writeType(std::get<1>(values_));
    		switch (getSerial()) {
    		case TESTEXTENDEDPOLYMORPHICSTRUCT_SERIAL:
    			static_cast<TestExtendedPolymorphicStruct *>(this)->template writeType<_Output>(_output);
    			break;
    		default:
    			break;
    		}
    	}
    
    	template<class _Output>
    	void writeValue(CommonAPI::OutputStream<_Output> &_output, const CommonAPI::EmptyDeployment *_depl) {
    		_output.template writeValue<CommonAPI::EmptyDeployment>(std::get<0>(values_));
    		_output.template writeValue<CommonAPI::EmptyDeployment>(std::get<1>(values_));
    		switch (getSerial()) {
    		case TESTEXTENDEDPOLYMORPHICSTRUCT_SERIAL:
    			static_cast<TestExtendedPolymorphicStruct *>(this)->template writeValue<_Output>(_output, _depl);
    			break;
    		default:
    			break;
    		}
    	}
    
    	template<class _Output, class _Deployment>
    	void writeValue(CommonAPI::OutputStream<_Output> &_output, const _Deployment *_depl) {
    		_output.template writeValue<>(std::get<0>(values_), _depl, std::get<0>(_depl->values_));
    		_output.template writeValue<>(std::get<1>(values_), _depl, std::get<1>(_depl->values_));
    		switch (getSerial()) {
    		case TESTEXTENDEDPOLYMORPHICSTRUCT_SERIAL:
    			static_cast<TestExtendedPolymorphicStruct *>(this)->template writeValue<>(_output, _depl);
    			break;
    		default:
    			break;
    		}
    	}
    	/**
    	 * description: the name of the property
    	 */
    	inline const ::commonapi::tests::PredefinedTypeCollection::TestString &getTestString() const { return std::get<0>(values_); }
    	inline void setTestString(const ::commonapi::tests::PredefinedTypeCollection::TestString &_value) { std::get<0>(values_) = _value; }
    	/**
    	 * description: the actual value
    	 */
    	inline const uint16_t &getUintValue() const { return std::get<1>(values_); }
    	inline void setUintValue(const uint16_t &_value) { std::get<1>(values_) = _value; }
    	
    	std::tuple<::commonapi::tests::PredefinedTypeCollection::TestString, uint16_t> values_;
    	bool operator==(const TestPolymorphicStruct &_other) const;
    	inline bool operator!=(const TestPolymorphicStruct &_other) const {
    		return !((*this) == _other);
    	}
    
    };
    struct TestExtendedPolymorphicStruct : TestPolymorphicStruct {
    	const CommonAPI::Serial getSerial() const {	return TESTEXTENDEDPOLYMORPHICSTRUCT_SERIAL; }
    	
    	TestExtendedPolymorphicStruct() {
    	}
    	TestExtendedPolymorphicStruct(const ::commonapi::tests::PredefinedTypeCollection::TestString &_testString, const uint16_t &_uintValue, const uint32_t &_additionalValue)
    	: TestPolymorphicStruct(_testString, _uintValue)
    	{
    		std::get<0>(values_) = _additionalValue;
    	}
    	template<class _Input>
    	void readValue(CommonAPI::InputStream<_Input> &_input, const CommonAPI::EmptyDeployment *_depl) {
    		_input.template readValue<CommonAPI::EmptyDeployment>(std::get<0>(values_));
    	}
    
    	template<class _Input, class _Deployment>
    	void readValue(CommonAPI::InputStream<_Input> &_input, const _Deployment *_depl) {
    		_input.template readValue<>(std::get<0>(values_), std::get<2>(_depl->values_));
    	}
    
    	template<class _Output>
    	void writeType(CommonAPI::TypeOutputStream<_Output> &_output) {
    		_output.writeType(std::get<0>(values_));
    	}
    
    	template<class _Output>
    	void writeValue(CommonAPI::OutputStream<_Output> &_output, const CommonAPI::EmptyDeployment *_depl) {
    		_output.template writeValue<CommonAPI::EmptyDeployment>(std::get<0>(values_));
    	}
    
    	template<class _Output, class _Deployment>
    	void writeValue(CommonAPI::OutputStream<_Output> &_output, const _Deployment *_depl) {
    		_output.template writeValue<>(std::get<0>(values_), _depl, std::get<2>(_depl->values_));
    	}
    	inline const uint32_t &getAdditionalValue() const { return std::get<0>(values_); }
    	inline void setAdditionalValue(const uint32_t &_value) { std::get<0>(values_) = _value; }
    	
    	std::tuple<uint32_t> values_;
    	bool operator==(const TestExtendedPolymorphicStruct &_other) const;
    	inline bool operator!=(const TestExtendedPolymorphicStruct &_other) const {
    		return !((*this) == _other);
    	}
    
    };
    typedef std::unordered_map<uint8_t, std::shared_ptr<TestPolymorphicStruct>> MapIntToPolymorphic;
    struct StructWithPolymorphicMember : CommonAPI::Struct<uint32_t, std::shared_ptr<TestPolymorphicStruct>> {
    	
    	StructWithPolymorphicMember() {
    	}
    	StructWithPolymorphicMember(const uint32_t &_numberValue, const std::shared_ptr<TestPolymorphicStruct> &_polymorphicMember)
    	{
    		std::get<0>(values_) = _numberValue;
    		std::get<1>(values_) = _polymorphicMember;
    	}
    	inline const uint32_t &getNumberValue() const { return std::get<0>(values_); }
    	inline void setNumberValue(const uint32_t &_value) { std::get<0>(values_) = _value; }
    	inline const std::shared_ptr<TestPolymorphicStruct> &getPolymorphicMember() const { return std::get<1>(values_); }
    	inline void setPolymorphicMember(const std::shared_ptr<TestPolymorphicStruct> &_value) { std::get<1>(values_) = _value; }
    	bool operator==(const StructWithPolymorphicMember &_other) const;
    	inline bool operator!=(const StructWithPolymorphicMember &_other) const {
    		return !((*this) == _other);
    	}
    
    };
    struct StructWithEnumKeyMap : CommonAPI::Struct<TestEnumMap> {
    	
    	StructWithEnumKeyMap() {
    	}
    	StructWithEnumKeyMap(const TestEnumMap &_testMap)
    	{
    		std::get<0>(values_) = _testMap;
    	}
    	inline const TestEnumMap &getTestMap() const { return std::get<0>(values_); }
    	inline void setTestMap(const TestEnumMap &_value) { std::get<0>(values_) = _value; }
    	bool operator==(const StructWithEnumKeyMap &_other) const;
    	inline bool operator!=(const StructWithEnumKeyMap &_other) const {
    		return !((*this) == _other);
    	}
    
    };



static inline const char* getTypeCollectionName() {
    static const char* typeCollectionName = "commonapi.tests.DerivedTypeCollection";
    return typeCollectionName;
}


}; // struct DerivedTypeCollection

} // namespace tests
} // namespace commonapi

namespace CommonAPI {
}


namespace std {
    //Hash for TestEnum
    template<>
    struct hash<::commonapi::tests::DerivedTypeCollection::TestEnum> {
        inline size_t operator()(const ::commonapi::tests::DerivedTypeCollection::TestEnum& testEnum) const {
            return static_cast<int32_t>(testEnum);
        }
    };
    //Hash for TestEnumExtended2
    template<>
    struct hash<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2> {
        inline size_t operator()(const ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2& testEnumExtended2) const {
            return static_cast<int32_t>(testEnumExtended2);
        }
    };
    //Hash for TestEnumMissingValue
    template<>
    struct hash<::commonapi::tests::DerivedTypeCollection::TestEnumMissingValue> {
        inline size_t operator()(const ::commonapi::tests::DerivedTypeCollection::TestEnumMissingValue& testEnumMissingValue) const {
            return static_cast<int32_t>(testEnumMissingValue);
        }
    };
    //Hash for TestEnumExtended
    template<>
    struct hash<::commonapi::tests::DerivedTypeCollection::TestEnumExtended> {
        inline size_t operator()(const ::commonapi::tests::DerivedTypeCollection::TestEnumExtended& testEnumExtended) const {
            return static_cast<int32_t>(testEnumExtended);
        }
    };
}

#endif // COMMONAPI_TESTS_Derived_Type_Collection_HPP_