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 2760 : void printJSON(std::stringstream& ss) const { ss << _json; }
12 4670 : int fillFromJSON(std::string const& newjson) {
13 4670 : _json = newjson;
14 4670 : 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 5288 : virtual ~ConfigurationBase() = default;
28 : };
29 :
30 : struct TestConfiguration001 final : public ConfigurationBase {
31 22284 : std::string getConfigurationName() const { return "TestConfiguration001"; }
32 7106 : ConfigurationView& getView() { return view; }
33 2623 : ConfigurationView const& getView() const { return view; }
34 :
35 2323 : ConfigurationView* getViewP() { return &view; }
36 2646 : int getViewVersion() const { return view.version; }
37 : ConfigurationView view;
38 5097 : ~TestConfiguration001() = default;
39 : };
40 :
41 : struct TestConfiguration002 final : public ConfigurationBase {
42 711 : std::string getConfigurationName() const { return "TestConfiguration002"; }
43 137 : ConfigurationView& getView() { return view; }
44 113 : ConfigurationView const& getView() const { return view; }
45 :
46 6 : ConfigurationView* getViewP() { return &view; }
47 113 : int getViewVersion() const { return view.version; }
48 : ConfigurationView view;
49 181 : ~TestConfiguration002() = default;
50 : };
51 : } // namespace ots
52 :
53 : #endif //_ots_DatabaseConfigurationInterface_h_
|