Dev for variant
[profile/ivi/common-api-dbus-runtime.git] / src / test / DBusSerializableStructTest.h
1 /* Copyright (C) 2013 BMW Group
2  * Author: Manfred Bathelt (manfred.bathelt@bmw.de)
3  * Author: Juergen Gehring (juergen.gehring@bmw.de)
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef DEMO_POSITIONING_H_
8 #define DEMO_POSITIONING_H_
9
10
11 #include <common-api-dbus/dbus-serializable-struct.h>
12 #include <vector>
13
14
15 namespace common {
16 namespace api {
17 namespace test {
18
19
20 struct TestStruct: public common::api::dbus::SerializableStruct {
21         TestStruct() = default;
22         TestStruct(const uint32_t& fromIntValue, const double& fromDoubleValue);
23
24         virtual common::api::dbus::DBusInputMessageStream& readFromDBusInputMessageStream(
25                         common::api::dbus::DBusInputMessageStream& inputMessageStream);
26
27         virtual common::api::dbus::DBusOutputMessageStream& writeToDBusOutputMessageStream(
28                         common::api::dbus::DBusOutputMessageStream& outputMessageStream) const;
29
30         uint32_t intValue;
31         double doubleValue;
32 };
33
34
35 struct TestStructExtended: public TestStruct {
36         TestStructExtended() = default;
37
38         TestStructExtended(const uint32_t& fromIntValue, const double& fromDoubleValue, const std::string& fromStringValue);
39
40         virtual common::api::dbus::DBusInputMessageStream& readFromDBusInputMessageStream(
41                         common::api::dbus::DBusInputMessageStream& inputMessageStream);
42
43         virtual common::api::dbus::DBusOutputMessageStream& writeToDBusOutputMessageStream(
44                         common::api::dbus::DBusOutputMessageStream& outputMessageStream) const;
45
46         std::string stringValue;
47 };
48
49
50 typedef std::vector<TestStruct> TestStructArray;
51 typedef std::vector<TestStructExtended> TestStructExtendedArray;
52
53
54 } //namespace test
55
56 namespace dbus {
57
58 template<>
59 struct Alignment<common::api::test::TestStruct>: SizeConstant<8> { };
60
61 template<>
62 struct Alignment<common::api::test::TestStructExtended>: SizeConstant<8> { };
63
64 } //namespace dbus
65 } //namespace api
66 } //namespace common
67
68 #endif /* DEMO_POSITIONING_H_ */