blob: 61c2b6f1b87415129636fd6ffa3091a642ae4eb8 [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"
Brad Bishopc1283ae2017-05-20 21:42:38 -04008#include "journal.hpp"
Brad Bishop4b916f12017-05-23 18:06:38 -04009#include "propertywatchimpl.hpp"
10#include "sdbusplus.hpp"
Brad Bishop05b0c1e2017-05-23 00:24:01 -040011
12using namespace std::string_literals;
13
Brad Bishop870c3fc2017-05-22 23:23:13 -040014namespace phosphor
15{
16namespace dbus
17{
18namespace monitoring
19{
20
Brad Bishop0e7df132017-05-23 17:58:12 -040021struct ConfigMeta
22{
23 using Meta = std::array<std::string, ${len(meta)}>;
24
25 static auto& get()
26 {
27 static const Meta meta =
28 {
29% for m in meta:
30 "${m.name}"s,
31% endfor
32 };
33 return meta;
34 }
35};
36
37struct ConfigPaths
38{
39 using Paths = std::array<std::string, ${len(paths)}>;
40
41 static auto& get()
42 {
43 static const Paths paths =
44 {
45% for p in paths:
46 "${p.name}"s,
47% endfor
48 };
49 return paths;
50 }
51};
Brad Bishope73b2c32017-05-23 18:01:54 -040052
53struct ConfigInterfaces
54{
55 using Interfaces = std::array<std::string, ${len(interfaces)}>;
56
57 static auto& get()
58 {
59 static const Interfaces interfaces =
60 {
61% for i in interfaces:
62 "${i.name}"s,
63% endfor
64 };
65 return interfaces;
66 }
67};
68
69struct ConfigProperties
70{
71 using Properties = std::array<std::string, ${len(propertynames)}>;
72
73 static auto& get()
74 {
75 static const Properties properties =
76 {
77% for p in propertynames:
78 "${p.name}"s,
79% endfor
80 };
81 return properties;
82 }
83};
Brad Bishop4b916f12017-05-23 18:06:38 -040084
85struct ConfigPropertyStorage
86{
87 using Storage = std::array<any_ns::any, ${len(instances)}>;
88
89 static auto& get()
90 {
91 static Storage storage;
92 return storage;
93 }
94};
95
96struct ConfigPropertyIndicies
97{
98 using PropertyIndicies = std::array<PropertyIndex, ${len(instancegroups)}>;
99
100 static auto& get()
101 {
102 static const PropertyIndicies propertyIndicies =
103 {
104 {
105% for g in instancegroups:
106 {
107 % for i in g.members:
108 {
109 PropertyIndex::key_type
110 {
Brad Bishopc1283ae2017-05-20 21:42:38 -0400111 std::cref(ConfigPaths::get()[${i[0]}]),
112 std::cref(ConfigInterfaces::get()[${i[2]}]),
113 std::cref(ConfigProperties::get()[${i[3]}])
Brad Bishop4b916f12017-05-23 18:06:38 -0400114 },
115 PropertyIndex::mapped_type
116 {
Brad Bishopc1283ae2017-05-20 21:42:38 -0400117 std::cref(ConfigMeta::get()[${i[1]}]),
118 std::cref(ConfigMeta::get()[${i[4]}]),
119 std::ref(ConfigPropertyStorage::get()[${i[5]}])
Brad Bishop4b916f12017-05-23 18:06:38 -0400120 },
121 },
122 % endfor
123 },
124% endfor
125 }
126 };
127 return propertyIndicies;
128 }
129};
130
Brad Bishopc1283ae2017-05-20 21:42:38 -0400131struct ConfigPropertyCallbacks
132{
133 using Callbacks = std::array<std::unique_ptr<Callback>, ${len(callbacks)}>;
134
135 static auto& get()
136 {
137 static const Callbacks propertyCallbacks =
138 {
139% for c in callbacks:
140 ${c.construct(loader, indent=indent +3)},
141% endfor
142 };
143 return propertyCallbacks;
144 }
145};
146
Brad Bishop4b916f12017-05-23 18:06:38 -0400147struct ConfigPropertyWatches
148{
149 using PropertyWatches = std::array<std::unique_ptr<Watch>, ${len(watches)}>;
150
151 static auto& get()
152 {
153 static const PropertyWatches propertyWatches =
154 {
155% for w in watches:
156 std::make_unique<PropertyWatchOfType<${w.datatype}, SDBusPlus>>(
157 ConfigPropertyIndicies::get()[${w.instances}]),
158% endfor
159 };
160 return propertyWatches;
161 }
162};
Brad Bishop870c3fc2017-05-22 23:23:13 -0400163} // namespace monitoring
164} // namespace dbus
165} // namespace phosphor