30 #ifndef EXOTICA_CORE_PROPERTY_H_ 31 #define EXOTICA_CORE_PROPERTY_H_ 37 #include <boost/any.hpp> 38 #include <initializer_list> 47 boost::any
Get()
const;
53 Property(
const std::string& prop_name);
55 Property(
const std::string& prop_name,
bool is_required, boost::any val);
56 Property(std::initializer_list<boost::any> val);
61 const std::string&
GetName()
const;
75 Initializer(
const std::string& name,
const std::map<std::string, boost::any>& properties);
76 const std::string&
GetName()
const;
77 void SetName(
const std::string& name);
78 void AddProperty(
const Property& prop);
79 boost::any GetProperty(
const std::string& name)
const;
80 void SetProperty(
const std::string& name, boost::any);
81 bool HasProperty(
const std::string& name)
const;
82 std::vector<std::string> GetPropertyNames()
const;
93 virtual void Check(
const Initializer& other)
const = 0;
95 virtual std::vector<Initializer> GetAllTemplates()
const = 0;
104 virtual void InstantiateInternal(
const Initializer& init) = 0;
106 virtual std::vector<Initializer> GetAllTemplates()
const = 0;
109 template <class C, typename = typename std::enable_if<std::is_base_of<InitializerBase, C>::value, C>::type>
115 InstantiateBase(init);
123 return C().GetTemplate();
128 return C().GetAllTemplates();
143 #endif // EXOTICA_CORE_PROPERTY_H_ virtual void InstantiateBase(const Initializer &init)
Initializer GetInitializerTemplate() override
bool IsStringType() const
bool IsInitializerVectorType() const
std::vector< Initializer > GetAllTemplates() const override
const C & GetParameters() const
Property(const std::string &prop_name)
std::string GetType() const
std::map< std::string, Property > properties_
const std::string & GetName() const
virtual void Instantiate(const C &init)
void InstantiateInternal(const Initializer &init) override