File tree 7 files changed +791
-60
lines changed
7 files changed +791
-60
lines changed Original file line number Diff line number Diff line change 39
39
#include < cloe/simulator.hpp> // for SimulatorFactory
40
40
#include < cloe/trigger.hpp> // for Source
41
41
#include < cloe/utility/command.hpp> // for Command
42
+ #include < fable/schema/factory.hpp> // for Factory
42
43
43
44
#include " plugin.hpp" // for Plugin
44
45
Original file line number Diff line number Diff line change @@ -51,6 +51,8 @@ if(BuildTests)
51
51
src/fable/environment_test.cpp
52
52
src/fable/schema/const_test.cpp
53
53
src/fable/schema/enum_test.cpp
54
+ src/fable/schema/factory_test.cpp
55
+ src/fable/schema/factory_advanced_test.cpp
54
56
src/fable/schema/number_test.cpp
55
57
src/fable/schema/optional_test.cpp
56
58
src/fable/schema/struct_test.cpp
Original file line number Diff line number Diff line change 132
132
#include < fable/schema/const.hpp> // for Const<>
133
133
#include < fable/schema/duration.hpp> // for Duration<>
134
134
#include < fable/schema/enum.hpp> // for Enum<>
135
- #include < fable/schema/factory.hpp> // for Factory<>
136
135
#include < fable/schema/ignore.hpp> // for Ignore
137
136
#include < fable/schema/interface.hpp> // for Interface, Box
138
137
#include < fable/schema/json.hpp> // for FromJson<>
Original file line number Diff line number Diff line change @@ -45,19 +45,22 @@ class FromConfable : public Base<FromConfable<T>> {
45
45
using Type = T;
46
46
47
47
explicit FromConfable (std::string&& desc = " " ) {
48
- schema_ = T ().schema ();
48
+ schema_ = Type ().schema ();
49
49
schema_.reset_ptr ();
50
50
this ->type_ = schema_.type ();
51
51
this ->desc_ = std::move (desc);
52
52
}
53
53
54
54
FromConfable (Type* ptr, std::string&& desc)
55
- : Base<FromConfable<T >>(ptr->schema ().type(), std::move(desc))
55
+ : Base<FromConfable<Type >>(ptr->schema ().type(), std::move(desc))
56
56
, schema_(ptr->schema ())
57
57
, ptr_(ptr) {
58
58
assert (ptr != nullptr );
59
59
}
60
60
61
+ public: // Special
62
+ Box get_confable_schema () const { return schema_.clone (); }
63
+
61
64
public: // Overrides
62
65
Json json_schema () const override {
63
66
Json j = schema_.json_schema ();
@@ -86,7 +89,7 @@ class FromConfable : public Base<FromConfable<T>> {
86
89
Json serialize (const Type& x) const { return x.to_json (); }
87
90
88
91
Type deserialize (const Conf& c) const {
89
- T tmp;
92
+ Type tmp;
90
93
tmp.from_conf (c);
91
94
return tmp;
92
95
}
You can’t perform that action at this time.
0 commit comments