blob: 0911e3af2da8af76ac84af6a4bf2ad8a73699513 [file] [log] [blame]
Brad Bishop870c3fc2017-05-22 23:23:13 -04001## This file is a template, the comment below is emitted into the generated file
2/* This is an auto generated file. Do not edit. */
3#pragma once
4
Brad Bishop05b0c1e2017-05-23 00:24:01 -04005#include <array>
6#include <string>
Brad Bishop4b916f12017-05-23 18:06:38 -04007#include "data_types.hpp"
8#include "propertywatchimpl.hpp"
9#include "sdbusplus.hpp"
Brad Bishop05b0c1e2017-05-23 00:24:01 -040010
11using namespace std::string_literals;
12
Brad Bishop870c3fc2017-05-22 23:23:13 -040013namespace phosphor
14{
15namespace dbus
16{
17namespace monitoring
18{
19
Brad Bishop0e7df132017-05-23 17:58:12 -040020struct ConfigMeta
21{
22 using Meta = std::array<std::string, ${len(meta)}>;
23
24 static auto& get()
25 {
26 static const Meta meta =
27 {
28% for m in meta:
29 "${m.name}"s,
30% endfor
31 };
32 return meta;
33 }
34};
35
36struct ConfigPaths
37{
38 using Paths = std::array<std::string, ${len(paths)}>;
39
40 static auto& get()
41 {
42 static const Paths paths =
43 {
44% for p in paths:
45 "${p.name}"s,
46% endfor
47 };
48 return paths;
49 }
50};
Brad Bishope73b2c32017-05-23 18:01:54 -040051
52struct ConfigInterfaces
53{
54 using Interfaces = std::array<std::string, ${len(interfaces)}>;
55
56 static auto& get()
57 {
58 static const Interfaces interfaces =
59 {
60% for i in interfaces:
61 "${i.name}"s,
62% endfor
63 };
64 return interfaces;
65 }
66};
67
68struct ConfigProperties
69{
70 using Properties = std::array<std::string, ${len(propertynames)}>;
71
72 static auto& get()
73 {
74 static const Properties properties =
75 {
76% for p in propertynames:
77 "${p.name}"s,
78% endfor
79 };
80 return properties;
81 }
82};
Brad Bishop4b916f12017-05-23 18:06:38 -040083
84struct ConfigPropertyStorage
85{
86 using Storage = std::array<any_ns::any, ${len(instances)}>;
87
88 static auto& get()
89 {
90 static Storage storage;
91 return storage;
92 }
93};
94
95struct ConfigPropertyIndicies
96{
97 using PropertyIndicies = std::array<PropertyIndex, ${len(instancegroups)}>;
98
99 static auto& get()
100 {
101 static const PropertyIndicies propertyIndicies =
102 {
103 {
104% for g in instancegroups:
105 {
106 % for i in g.members:
107 {
108 PropertyIndex::key_type
109 {
110 ConfigPaths::get()[${i[0]}],
111 ConfigInterfaces::get()[${i[2]}],
112 ConfigProperties::get()[${i[3]}]
113 },
114 PropertyIndex::mapped_type
115 {
116 ConfigMeta::get()[${i[1]}],
117 ConfigMeta::get()[${i[4]}],
118 ConfigPropertyStorage::get()[${i[5]}]
119 },
120 },
121 % endfor
122 },
123% endfor
124 }
125 };
126 return propertyIndicies;
127 }
128};
129
130struct ConfigPropertyWatches
131{
132 using PropertyWatches = std::array<std::unique_ptr<Watch>, ${len(watches)}>;
133
134 static auto& get()
135 {
136 static const PropertyWatches propertyWatches =
137 {
138% for w in watches:
139 std::make_unique<PropertyWatchOfType<${w.datatype}, SDBusPlus>>(
140 ConfigPropertyIndicies::get()[${w.instances}]),
141% endfor
142 };
143 return propertyWatches;
144 }
145};
Brad Bishop870c3fc2017-05-22 23:23:13 -0400146} // namespace monitoring
147} // namespace dbus
148} // namespace phosphor