#ifndef OBJECT_INFO_HPP #define OBJECT_INFO_HPP #include "matador/object/basic_object_info.hpp" #include "matador/object/object_definition.hpp" namespace matador::object { class schema_node; template class object_info final : public basic_object_info { public: using create_func = std::function()>; object_info(const std::shared_ptr& node, const std::shared_ptr &ref_column) : basic_object_info(node, {}, ref_column, {}) , creator_([]{return std::make_unique(); }){ } object_info(const std::shared_ptr& node, utils::identifier &&pk, const std::shared_ptr &ref_column, object_definition &&definition) : basic_object_info(node, std::move(pk), ref_column, std::move(definition)) , creator_([]{return std::make_unique(); }){ } object_info(const std::shared_ptr& node, utils::identifier &&pk, const std::shared_ptr &ref_column, object_definition &&definition, create_func&& creator) : basic_object_info(node, std::move(pk), ref_column, std::move(definition)) , creator_(std::move(creator)){ } object_info(const std::shared_ptr& node, object_definition &&definition, create_func&& creator) : basic_object_info(node, std::move(definition)) , creator_(std::move(creator)){ } const Type &prototype() const { return prototype_; } std::unique_ptr create() const { return creator_(); } private: Type prototype_; create_func creator_{[]{ return std::make_unique(); }}; }; template using object_info_ref = std::reference_wrapper>; namespace detail { struct null_type {}; } using null_info = object_info; } #endif //OBJECT_INFO_HPP