summaryrefslogtreecommitdiff
path: root/include/CommonAPI/Deployment.hpp
blob: c4f8550a3f9af6f68252feae4baaddd10d29675e (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
// Copyright (C) 2014 BMW Group
// Author: Lutz Bichler (lutz.bichler@bmw.de)
// 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/.

#if !defined (COMMONAPI_INTERNAL_COMPILATION)
#error "Only <CommonAPI/CommonAPI.h> can be included directly, this file may disappear or change contents."
#endif

#ifndef COMMONAPI_DEPLOYMENT_HPP_
#define COMMONAPI_DEPLOYMENT_HPP_

#include <tuple>

namespace CommonAPI {
// The binding-specific deployment parameters should be
// defined like this:
//
// struct BindingUInt16Deployment : CommonAPI::Deployment<> {
// 		// Binding-specific bool deployment parameters
// };
//
// struct BindingStringDeployment : CommonAPI::Deployment<> {
// 		// Binding-specific String deployment parameters
// };
//
// template<typename... _Types>
// struct BindingStructDeployment
// 			: CommonAPI::Deployment<_Types...> {
// 		BindingStructDeployment(<SPECIFIC PARAMETERS>, _Types... t)
// 			: CommonAPI::Deployment<_Types...>(t),
// 			  <SPECIFIC INITIALIZERS> {};
//
// 		// Binding-specific struct deployment parameters
// };
//
// The generated code needs to use these definitions to
// provide the deployment informations for the actual data.
// E.g., for struct consisting of a boolean and a string
// value, it needs to generate:
//
// CommonAPI::BindingStructDeployment<
//     CommonAPI::BindingBoolDeployment,
//     CommonAPI::BindingStringDeployment
//  > itsDeployment(<PARAMS);
template<typename... _Types>
struct Deployment {
	Deployment(_Types*... _values) : values_(_values...) {}

	std::tuple<_Types*...> values_;
};

template<typename _ElementDepl>
struct ArrayDeployment {
	ArrayDeployment(_ElementDepl *_elementDepl)
		: elementDepl_(_elementDepl) {}

	_ElementDepl *elementDepl_;
};

template<typename _KeyDepl, typename _ValueDepl>
struct MapDeployment {
	MapDeployment(_KeyDepl *_key, _ValueDepl *_value)
		: key_(_key), value_(_value) {}

	const _KeyDepl *key_;
	const _ValueDepl *value_;
};

// Convenience definition of an empty deployment.
typedef Deployment<> EmptyDeployment;

} // namespace CommonAPI

#endif // COMMONAPI_DEPLOYABLE_HPP_