2 * This file was generated by the CommonAPI Generators.
3 * Used org.genivi.commonapi.core 2.1.5.qualifier.
4 * Used org.franca.core 0.8.10.201309262002.
6 * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
7 * If a copy of the MPL was not distributed with this file, You can obtain one at
8 * http://mozilla.org/MPL/2.0/.
10 #ifndef COMMONAPI_TESTS_Derived_Type_Collection_H_
11 #define COMMONAPI_TESTS_Derived_Type_Collection_H_
14 #include <commonapi/tests/PredefinedTypeCollection.h>
16 #if !defined (COMMONAPI_INTERNAL_COMPILATION)
17 #define COMMONAPI_INTERNAL_COMPILATION
20 #include <CommonAPI/InputStream.h>
21 #include <CommonAPI/OutputStream.h>
22 #include <CommonAPI/SerializableStruct.h>
23 #include <CommonAPI/types.h>
26 #include <unordered_map>
29 #undef COMMONAPI_INTERNAL_COMPILATION
34 namespace DerivedTypeCollection {
35 struct TestStruct: CommonAPI::SerializableStruct {
37 * the name of the property
39 PredefinedTypeCollection::TestString testString;
45 TestStruct() = default;
46 TestStruct(const PredefinedTypeCollection::TestString& testString, const uint16_t& uintValue);
49 virtual void readFromInputStream(CommonAPI::InputStream& inputStream);
50 virtual void writeToOutputStream(CommonAPI::OutputStream& outputStream) const;
52 static inline void writeToTypeOutputStream(CommonAPI::TypeOutputStream& typeOutputStream) {
53 typeOutputStream.writeStringType();
54 typeOutputStream.writeUInt16Type();
57 typedef std::vector<TestStruct> TestArrayTestStruct;
58 typedef std::unordered_map<uint32_t, TestArrayTestStruct> TestMap;
62 enum class TestEnum: int32_t {
68 * no error - positive reply
81 // Definition of a comparator still is necessary for GCC 4.4.1, topic is fixed since 4.5.1
82 struct TestEnumComparator;
83 enum class TestEnumExtended: int32_t {
84 E_UNKNOWN = TestEnum::E_UNKNOWN,
85 E_OK = TestEnum::E_OK,
86 E_OUT_OF_RANGE = TestEnum::E_OUT_OF_RANGE,
87 E_NOT_USED = TestEnum::E_NOT_USED
95 // Definition of a comparator still is necessary for GCC 4.4.1, topic is fixed since 4.5.1
96 struct TestEnumExtendedComparator;
97 enum class TestEnumExtended2: int32_t {
98 E_UNKNOWN = TestEnum::E_UNKNOWN,
99 E_OK = TestEnum::E_OK,
100 E_OUT_OF_RANGE = TestEnum::E_OUT_OF_RANGE,
101 E_NOT_USED = TestEnum::E_NOT_USED,
103 E_NEW = TestEnumExtended::E_NEW
111 // Definition of a comparator still is necessary for GCC 4.4.1, topic is fixed since 4.5.1
112 struct TestEnumExtended2Comparator;
113 struct TestStructExtended: TestStruct {
114 TestEnumExtended2 testEnumExtended2;
116 TestStructExtended() = default;
117 TestStructExtended(const PredefinedTypeCollection::TestString& testString, const uint16_t& uintValue, const TestEnumExtended2& testEnumExtended2);
120 virtual void readFromInputStream(CommonAPI::InputStream& inputStream);
121 virtual void writeToOutputStream(CommonAPI::OutputStream& outputStream) const;
123 static inline void writeToTypeOutputStream(CommonAPI::TypeOutputStream& typeOutputStream) {
124 TestStruct::writeToTypeOutputStream(typeOutputStream);
125 typeOutputStream.writeInt32Type();
128 typedef std::unordered_map<TestEnum, std::string, CommonAPI::EnumHasher<TestEnum>> TestEnumMap;
129 enum class TestEnumMissingValue: int32_t {
138 // Definition of a comparator still is necessary for GCC 4.4.1, topic is fixed since 4.5.1
139 struct TestEnumMissingValueComparator;
140 typedef std::vector<uint64_t> TestArrayUInt64;
141 struct TestPolymorphicStruct: CommonAPI::SerializablePolymorphicStruct {
143 * the name of the property
145 PredefinedTypeCollection::TestString testString;
151 TestPolymorphicStruct() = default;
152 TestPolymorphicStruct(const PredefinedTypeCollection::TestString& testString, const uint16_t& uintValue);
154 enum: uint32_t { SERIAL_ID = 0x8f51a326 };
156 static TestPolymorphicStruct* createInstance(const uint32_t& serialId);
158 virtual uint32_t getSerialId() const;
159 virtual void createTypeSignature(CommonAPI::TypeOutputStream& typeOutputStream) const;
161 virtual void readFromInputStream(CommonAPI::InputStream& inputStream);
162 virtual void writeToOutputStream(CommonAPI::OutputStream& outputStream) const;
164 static inline void writeToTypeOutputStream(CommonAPI::TypeOutputStream& typeOutputStream) {
165 typeOutputStream.writeStringType();
166 typeOutputStream.writeUInt16Type();
169 struct TestExtendedPolymorphicStruct: TestPolymorphicStruct {
170 uint32_t additionalValue;
172 TestExtendedPolymorphicStruct() = default;
173 TestExtendedPolymorphicStruct(const PredefinedTypeCollection::TestString& testString, const uint16_t& uintValue, const uint32_t& additionalValue);
175 enum: uint32_t { SERIAL_ID = 0xa49310f2 };
177 static TestExtendedPolymorphicStruct* createInstance(const uint32_t& serialId);
179 virtual uint32_t getSerialId() const;
180 virtual void createTypeSignature(CommonAPI::TypeOutputStream& typeOutputStream) const;
182 virtual void readFromInputStream(CommonAPI::InputStream& inputStream);
183 virtual void writeToOutputStream(CommonAPI::OutputStream& outputStream) const;
185 static inline void writeToTypeOutputStream(CommonAPI::TypeOutputStream& typeOutputStream) {
186 TestPolymorphicStruct::writeToTypeOutputStream(typeOutputStream);
187 typeOutputStream.writeUInt32Type();
190 typedef std::unordered_map<uint8_t, std::shared_ptr<TestPolymorphicStruct>> MapIntToPolymorphic;
191 struct StructWithPolymorphicMember: CommonAPI::SerializableStruct {
192 uint32_t numberValue;
193 std::shared_ptr<TestPolymorphicStruct> polymorphicMember;
195 StructWithPolymorphicMember() = default;
196 StructWithPolymorphicMember(const uint32_t& numberValue, const std::shared_ptr<TestPolymorphicStruct>& polymorphicMember);
199 virtual void readFromInputStream(CommonAPI::InputStream& inputStream);
200 virtual void writeToOutputStream(CommonAPI::OutputStream& outputStream) const;
202 static inline void writeToTypeOutputStream(CommonAPI::TypeOutputStream& typeOutputStream) {
203 typeOutputStream.writeUInt32Type();
204 typeOutputStream.beginWriteStructType();
205 typeOutputStream.writeStringType();typeOutputStream.writeUInt16Type();
206 typeOutputStream.endWriteStructType();
209 struct StructWithEnumKeyMap: CommonAPI::SerializableStruct {
212 StructWithEnumKeyMap() = default;
213 StructWithEnumKeyMap(const TestEnumMap& testMap);
216 virtual void readFromInputStream(CommonAPI::InputStream& inputStream);
217 virtual void writeToOutputStream(CommonAPI::OutputStream& outputStream) const;
219 static inline void writeToTypeOutputStream(CommonAPI::TypeOutputStream& typeOutputStream) {
220 typeOutputStream.beginWriteMapType();
221 typeOutputStream.writeInt32Type();
222 typeOutputStream.writeStringType();
223 typeOutputStream.endWriteMapType();
227 bool operator==(const TestStructExtended& lhs, const TestStructExtended& rhs);
228 inline bool operator!=(const TestStructExtended& lhs, const TestStructExtended& rhs) {
229 return !(lhs == rhs);
231 inline CommonAPI::InputStream& operator>>(CommonAPI::InputStream& inputStream, TestEnum& enumValue) {
232 return inputStream.readEnumValue<int32_t>(enumValue);
235 inline CommonAPI::OutputStream& operator<<(CommonAPI::OutputStream& outputStream, const TestEnum& enumValue) {
236 return outputStream.writeEnumValue(static_cast<int32_t>(enumValue));
239 struct TestEnumComparator {
240 inline bool operator()(const TestEnum& lhs, const TestEnum& rhs) const {
241 return static_cast<int32_t>(lhs) < static_cast<int32_t>(rhs);
245 inline CommonAPI::InputStream& operator>>(CommonAPI::InputStream& inputStream, TestEnumExtended2& enumValue) {
246 return inputStream.readEnumValue<int32_t>(enumValue);
249 inline CommonAPI::OutputStream& operator<<(CommonAPI::OutputStream& outputStream, const TestEnumExtended2& enumValue) {
250 return outputStream.writeEnumValue(static_cast<int32_t>(enumValue));
253 struct TestEnumExtended2Comparator {
254 inline bool operator()(const TestEnumExtended2& lhs, const TestEnumExtended2& rhs) const {
255 return static_cast<int32_t>(lhs) < static_cast<int32_t>(rhs);
260 inline bool operator==(const TestEnumExtended2& lhs, const DerivedTypeCollection::TestEnum& rhs) {
261 return static_cast<int32_t>(lhs) == static_cast<int32_t>(rhs);
263 inline bool operator==(const DerivedTypeCollection::TestEnum& lhs, const TestEnumExtended2& rhs) {
264 return static_cast<int32_t>(lhs) == static_cast<int32_t>(rhs);
266 inline bool operator!=(const TestEnumExtended2& lhs, const DerivedTypeCollection::TestEnum& rhs) {
267 return static_cast<int32_t>(lhs) != static_cast<int32_t>(rhs);
269 inline bool operator!=(const DerivedTypeCollection::TestEnum& lhs, const TestEnumExtended2& rhs) {
270 return static_cast<int32_t>(lhs) != static_cast<int32_t>(rhs);
273 inline bool operator==(const TestEnumExtended2& lhs, const DerivedTypeCollection::TestEnumExtended& rhs) {
274 return static_cast<int32_t>(lhs) == static_cast<int32_t>(rhs);
276 inline bool operator==(const DerivedTypeCollection::TestEnumExtended& lhs, const TestEnumExtended2& rhs) {
277 return static_cast<int32_t>(lhs) == static_cast<int32_t>(rhs);
279 inline bool operator!=(const TestEnumExtended2& lhs, const DerivedTypeCollection::TestEnumExtended& rhs) {
280 return static_cast<int32_t>(lhs) != static_cast<int32_t>(rhs);
282 inline bool operator!=(const DerivedTypeCollection::TestEnumExtended& lhs, const TestEnumExtended2& rhs) {
283 return static_cast<int32_t>(lhs) != static_cast<int32_t>(rhs);
285 inline CommonAPI::InputStream& operator>>(CommonAPI::InputStream& inputStream, TestEnumMissingValue& enumValue) {
286 return inputStream.readEnumValue<int32_t>(enumValue);
289 inline CommonAPI::OutputStream& operator<<(CommonAPI::OutputStream& outputStream, const TestEnumMissingValue& enumValue) {
290 return outputStream.writeEnumValue(static_cast<int32_t>(enumValue));
293 struct TestEnumMissingValueComparator {
294 inline bool operator()(const TestEnumMissingValue& lhs, const TestEnumMissingValue& rhs) const {
295 return static_cast<int32_t>(lhs) < static_cast<int32_t>(rhs);
299 inline CommonAPI::InputStream& operator>>(CommonAPI::InputStream& inputStream, TestEnumExtended& enumValue) {
300 return inputStream.readEnumValue<int32_t>(enumValue);
303 inline CommonAPI::OutputStream& operator<<(CommonAPI::OutputStream& outputStream, const TestEnumExtended& enumValue) {
304 return outputStream.writeEnumValue(static_cast<int32_t>(enumValue));
307 struct TestEnumExtendedComparator {
308 inline bool operator()(const TestEnumExtended& lhs, const TestEnumExtended& rhs) const {
309 return static_cast<int32_t>(lhs) < static_cast<int32_t>(rhs);
314 inline bool operator==(const TestEnumExtended& lhs, const DerivedTypeCollection::TestEnum& rhs) {
315 return static_cast<int32_t>(lhs) == static_cast<int32_t>(rhs);
317 inline bool operator==(const DerivedTypeCollection::TestEnum& lhs, const TestEnumExtended& rhs) {
318 return static_cast<int32_t>(lhs) == static_cast<int32_t>(rhs);
320 inline bool operator!=(const TestEnumExtended& lhs, const DerivedTypeCollection::TestEnum& rhs) {
321 return static_cast<int32_t>(lhs) != static_cast<int32_t>(rhs);
323 inline bool operator!=(const DerivedTypeCollection::TestEnum& lhs, const TestEnumExtended& rhs) {
324 return static_cast<int32_t>(lhs) != static_cast<int32_t>(rhs);
326 bool operator==(const TestStruct& lhs, const TestStruct& rhs);
327 inline bool operator!=(const TestStruct& lhs, const TestStruct& rhs) {
328 return !(lhs == rhs);
330 bool operator==(const TestPolymorphicStruct& lhs, const TestPolymorphicStruct& rhs);
331 inline bool operator!=(const TestPolymorphicStruct& lhs, const TestPolymorphicStruct& rhs) {
332 return !(lhs == rhs);
334 bool operator==(const TestExtendedPolymorphicStruct& lhs, const TestExtendedPolymorphicStruct& rhs);
335 inline bool operator!=(const TestExtendedPolymorphicStruct& lhs, const TestExtendedPolymorphicStruct& rhs) {
336 return !(lhs == rhs);
338 bool operator==(const StructWithPolymorphicMember& lhs, const StructWithPolymorphicMember& rhs);
339 inline bool operator!=(const StructWithPolymorphicMember& lhs, const StructWithPolymorphicMember& rhs) {
340 return !(lhs == rhs);
342 bool operator==(const StructWithEnumKeyMap& lhs, const StructWithEnumKeyMap& rhs);
343 inline bool operator!=(const StructWithEnumKeyMap& lhs, const StructWithEnumKeyMap& rhs) {
344 return !(lhs == rhs);
348 static inline const char* getTypeCollectionName() {
349 static const char* typeCollectionName = "commonapi.tests.DerivedTypeCollection";
350 return typeCollectionName;
354 } // namespace DerivedTypeCollection
357 } // namespace commonapi
359 namespace CommonAPI {
362 struct BasicTypeWriter<commonapi::tests::DerivedTypeCollection::TestEnum> {
363 inline static void writeType (CommonAPI::TypeOutputStream& typeStream) {
364 typeStream.writeInt32EnumType();
369 struct InputStreamVectorHelper<commonapi::tests::DerivedTypeCollection::TestEnum> {
370 static void beginReadVector(InputStream& inputStream, const std::vector<commonapi::tests::DerivedTypeCollection::TestEnum>& vectorValue) {
371 inputStream.beginReadInt32EnumVector();
376 struct OutputStreamVectorHelper<commonapi::tests::DerivedTypeCollection::TestEnum> {
377 static void beginWriteVector(OutputStream& outputStream, const std::vector<commonapi::tests::DerivedTypeCollection::TestEnum>& vectorValue) {
378 outputStream.beginWriteInt32EnumVector(vectorValue.size());
382 struct BasicTypeWriter<commonapi::tests::DerivedTypeCollection::TestEnumExtended2> {
383 inline static void writeType (CommonAPI::TypeOutputStream& typeStream) {
384 typeStream.writeInt32EnumType();
389 struct InputStreamVectorHelper<commonapi::tests::DerivedTypeCollection::TestEnumExtended2> {
390 static void beginReadVector(InputStream& inputStream, const std::vector<commonapi::tests::DerivedTypeCollection::TestEnumExtended2>& vectorValue) {
391 inputStream.beginReadInt32EnumVector();
396 struct OutputStreamVectorHelper<commonapi::tests::DerivedTypeCollection::TestEnumExtended2> {
397 static void beginWriteVector(OutputStream& outputStream, const std::vector<commonapi::tests::DerivedTypeCollection::TestEnumExtended2>& vectorValue) {
398 outputStream.beginWriteInt32EnumVector(vectorValue.size());
402 struct BasicTypeWriter<commonapi::tests::DerivedTypeCollection::TestEnumMissingValue> {
403 inline static void writeType (CommonAPI::TypeOutputStream& typeStream) {
404 typeStream.writeInt32EnumType();
409 struct InputStreamVectorHelper<commonapi::tests::DerivedTypeCollection::TestEnumMissingValue> {
410 static void beginReadVector(InputStream& inputStream, const std::vector<commonapi::tests::DerivedTypeCollection::TestEnumMissingValue>& vectorValue) {
411 inputStream.beginReadInt32EnumVector();
416 struct OutputStreamVectorHelper<commonapi::tests::DerivedTypeCollection::TestEnumMissingValue> {
417 static void beginWriteVector(OutputStream& outputStream, const std::vector<commonapi::tests::DerivedTypeCollection::TestEnumMissingValue>& vectorValue) {
418 outputStream.beginWriteInt32EnumVector(vectorValue.size());
422 struct BasicTypeWriter<commonapi::tests::DerivedTypeCollection::TestEnumExtended> {
423 inline static void writeType (CommonAPI::TypeOutputStream& typeStream) {
424 typeStream.writeInt32EnumType();
429 struct InputStreamVectorHelper<commonapi::tests::DerivedTypeCollection::TestEnumExtended> {
430 static void beginReadVector(InputStream& inputStream, const std::vector<commonapi::tests::DerivedTypeCollection::TestEnumExtended>& vectorValue) {
431 inputStream.beginReadInt32EnumVector();
436 struct OutputStreamVectorHelper<commonapi::tests::DerivedTypeCollection::TestEnumExtended> {
437 static void beginWriteVector(OutputStream& outputStream, const std::vector<commonapi::tests::DerivedTypeCollection::TestEnumExtended>& vectorValue) {
438 outputStream.beginWriteInt32EnumVector(vectorValue.size());
448 struct hash<commonapi::tests::DerivedTypeCollection::TestEnum> {
449 inline size_t operator()(const commonapi::tests::DerivedTypeCollection::TestEnum& testEnum) const {
450 return static_cast<int32_t>(testEnum);
453 //Hash for TestEnumExtended2
455 struct hash<commonapi::tests::DerivedTypeCollection::TestEnumExtended2> {
456 inline size_t operator()(const commonapi::tests::DerivedTypeCollection::TestEnumExtended2& testEnumExtended2) const {
457 return static_cast<int32_t>(testEnumExtended2);
460 //Hash for TestEnumMissingValue
462 struct hash<commonapi::tests::DerivedTypeCollection::TestEnumMissingValue> {
463 inline size_t operator()(const commonapi::tests::DerivedTypeCollection::TestEnumMissingValue& testEnumMissingValue) const {
464 return static_cast<int32_t>(testEnumMissingValue);
467 //Hash for TestEnumExtended
469 struct hash<commonapi::tests::DerivedTypeCollection::TestEnumExtended> {
470 inline size_t operator()(const commonapi::tests::DerivedTypeCollection::TestEnumExtended& testEnumExtended) const {
471 return static_cast<int32_t>(testEnumExtended);
476 #endif // COMMONAPI_TESTS_Derived_Type_Collection_H_