Line data Source code
1 : #ifndef _ots_ConfigurationInterface_h_
2 : #define _ots_ConfigurationInterface_h_
3 :
4 : #include <sstream>
5 : #include <string>
6 :
7 : namespace ots {
8 : struct ConfigurationInterface {};
9 :
10 : struct ConfigurationView {
11 389 : void printJSON(std::stringstream& ss) const { ss << _json; }
12 52 : int fillFromJSON(std::string const& newjson) {
13 52 : _json = newjson;
14 52 : return 0;
15 : }
16 : std::string _json = "{\n\"testJSON\" : 123\n}";
17 : int version = 1;
18 : };
19 :
20 : struct ConfigurationBase {
21 0 : virtual std::string getConfigurationName() const { return "ConfigurationBase"; }
22 : virtual ConfigurationView& getView() = 0;
23 : virtual ConfigurationView const& getView() const = 0;
24 :
25 : virtual ConfigurationView* getViewP() = 0;
26 : virtual int getViewVersion() const = 0;
27 419 : virtual ~ConfigurationBase() = default;
28 : };
29 :
30 : struct TestConfiguration001 final : public ConfigurationBase {
31 7755 : std::string getConfigurationName() const { return "TestConfiguration001"; }
32 338 : ConfigurationView& getView() { return view; }
33 274 : ConfigurationView const& getView() const { return view; }
34 :
35 16 : ConfigurationView* getViewP() { return &view; }
36 274 : int getViewVersion() const { return view.version; }
37 : ConfigurationView view;
38 300 : ~TestConfiguration001() = default;
39 : };
40 :
41 : struct TestConfiguration002 final : public ConfigurationBase {
42 720 : std::string getConfigurationName() const { return "TestConfiguration002"; }
43 115 : ConfigurationView& getView() { return view; }
44 111 : ConfigurationView const& getView() const { return view; }
45 :
46 0 : ConfigurationView* getViewP() { return &view; }
47 111 : int getViewVersion() const { return view.version; }
48 : ConfigurationView view;
49 115 : ~TestConfiguration002() = default;
50 : };
51 :
52 : struct TestConfiguration003 final : public ConfigurationBase {
53 42 : std::string getConfigurationName() const { return "TestConfiguration003"; }
54 4 : ConfigurationView& getView() { return view; }
55 4 : ConfigurationView const& getView() const { return view; }
56 :
57 0 : ConfigurationView* getViewP() { return &view; }
58 4 : int getViewVersion() const { return view.version; }
59 : ConfigurationView view;
60 4 : ~TestConfiguration003() = default;
61 : };
62 : } // namespace ots
63 :
64 : #endif
|