#ifndef MATADOR_OBJECT_GENERATOR_HPP #define MATADOR_OBJECT_GENERATOR_HPP #include "matador/object/attribute.hpp" #include "matador/object/attribute_generator.hpp" #include "matador/object/constraint.hpp" namespace matador::object { class object_generator; class object { public: explicit object(std::string name, std::string alias = ""); void add_attribute(attribute attr) { auto &ref = attributes_.emplace_back(std::move(attr)); ref.owner_ = this; } static const attribute& create_attribute(std::string name, object& obj) { attribute attr{std::move(name)}; attr.owner_ = &obj; return obj.attributes_.emplace_back(std::move(attr)); } void add_constraint(class constraint c) { auto &ref = constraints_.emplace_back(std::move(c)); ref.owner_ = this; } [[nodiscard]] const std::string& name() const { return name_; } [[nodiscard]] const std::string& alias() const { return alias_; } [[nodiscard]] bool has_attributes() const { return attributes_.empty(); } [[nodiscard]] size_t attribute_count() const { return attributes_.size(); } [[nodiscard]] const std::vector& attributes() const { return attributes_; } [[nodiscard]] bool has_constraints() const { return constraints_.empty(); } [[nodiscard]] size_t constraint_count() const { return constraints_.size(); } [[nodiscard]] const std::vector& constraints() const { return constraints_; } private: friend class object_generator; std::string name_; std::string alias_; std::vector attributes_; std::vector constraints_; }; class object_generator { public: template object generate(std::string name, std::string alias = "") { object obj{std::move(name), std::move(alias)}; attribute_generator::generate(*this); Type obj2; access::process(gen, obj2); return obj; } private: }; } #endif //MATADOR_OBJECT_GENERATOR_HPP