diff --git a/include/yugawara/binding/factory.h b/include/yugawara/binding/factory.h index d4feb68..013a9f9 100644 --- a/include/yugawara/binding/factory.h +++ b/include/yugawara/binding/factory.h @@ -15,6 +15,7 @@ #include +#include #include #include @@ -52,7 +53,7 @@ class factory { * @brief creates a new index descriptor. * @param declaration the original declaration */ - [[nodiscard]] ::takatori::descriptor::relation index(std::shared_ptr declaration); + [[nodiscard]] ::takatori::descriptor::relation index(::takatori::util::maybe_shared_ptr declaration); /** * @brief creates a new exchange descriptor. @@ -145,7 +146,7 @@ class factory { * @brief creates a new schema descriptor. * @param declaration the original declaration */ - [[nodiscard]] ::takatori::descriptor::schema schema(std::shared_ptr declaration); + [[nodiscard]] ::takatori::descriptor::schema schema(::takatori::util::maybe_shared_ptr declaration); /** * @brief creates a new schema descriptor. @@ -170,8 +171,8 @@ class factory { /// @copydoc index(storage::index const&) [[nodiscard]] ::takatori::descriptor::relation operator()(storage::index const& declaration); - /// @copydoc index(std::shared_ptr) - [[nodiscard]] ::takatori::descriptor::relation operator()(std::shared_ptr declaration); + /// @copydoc index(::takatori::util::maybe_shared_ptr) + [[nodiscard]] ::takatori::descriptor::relation operator()(::takatori::util::maybe_shared_ptr declaration); /// @copydoc exchange() [[nodiscard]] ::takatori::descriptor::relation operator()(::takatori::plan::exchange const& declaration); @@ -197,8 +198,8 @@ class factory { /// @copydoc aggregate_function(aggregate::declaration&&) [[nodiscard]] ::takatori::descriptor::aggregate_function operator()(aggregate::declaration&& declaration); - /// @copydoc schema(std::shared_ptr) - [[nodiscard]] ::takatori::descriptor::schema operator()(std::shared_ptr declaration); + /// @copydoc schema(::takatori::util::maybe_shared_ptr) + [[nodiscard]] ::takatori::descriptor::schema operator()(::takatori::util::maybe_shared_ptr declaration); /// @copydoc schema(schema::declaration&&) [[nodiscard]] ::takatori::descriptor::schema operator()(schema::declaration&& declaration); diff --git a/src/yugawara/binding/factory.cpp b/src/yugawara/binding/factory.cpp index ae6186b..47eca4d 100644 --- a/src/yugawara/binding/factory.cpp +++ b/src/yugawara/binding/factory.cpp @@ -17,11 +17,13 @@ namespace yugawara::binding { +using ::takatori::util::maybe_shared_ptr; + ::takatori::descriptor::relation factory::index(storage::index const& declaration) { return wrap(std::make_shared(declaration)); } -::takatori::descriptor::relation factory::index(std::shared_ptr declaration) { +::takatori::descriptor::relation factory::index(maybe_shared_ptr declaration) { return wrap(std::make_shared(std::move(declaration))); } @@ -89,7 +91,7 @@ ::takatori::descriptor::aggregate_function factory::aggregate_function(aggregate return aggregate_function(std::make_shared(std::move(declaration))); } -::takatori::descriptor::schema factory::schema(std::shared_ptr declaration) { +::takatori::descriptor::schema factory::schema(maybe_shared_ptr declaration) { return wrap(std::make_shared(std::move(declaration))); } @@ -109,7 +111,7 @@ ::takatori::descriptor::relation factory::operator()(storage::index const& decla return index(declaration); } -::takatori::descriptor::relation factory::operator()(std::shared_ptr declaration) { +::takatori::descriptor::relation factory::operator()(maybe_shared_ptr declaration) { return index(std::move(declaration)); } @@ -146,7 +148,7 @@ ::takatori::descriptor::aggregate_function factory::operator()(aggregate::declar return aggregate_function(std::move(declaration)); } -::takatori::descriptor::schema factory::operator()(std::shared_ptr declaration) { +::takatori::descriptor::schema factory::operator()(maybe_shared_ptr declaration) { return schema(std::move(declaration)); }