Skip to content

Commit

Permalink
fix: revise binding::factory to accept more symbols.
Browse files Browse the repository at this point in the history
  • Loading branch information
ashigeru committed Jun 24, 2024
1 parent 11ccdb3 commit d7f83ed
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
13 changes: 7 additions & 6 deletions include/yugawara/binding/factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

#include <takatori/plan/exchange.h>

#include <takatori/util/maybe_shared_ptr.h>
#include <takatori/util/optional_ptr.h>

#include <yugawara/variable/declaration.h>
Expand Down Expand Up @@ -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<storage::index const> declaration);
[[nodiscard]] ::takatori::descriptor::relation index(::takatori::util::maybe_shared_ptr<storage::index const> declaration);

/**
* @brief creates a new exchange descriptor.
Expand Down Expand Up @@ -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<schema::declaration const> declaration);
[[nodiscard]] ::takatori::descriptor::schema schema(::takatori::util::maybe_shared_ptr<schema::declaration const> declaration);

/**
* @brief creates a new schema descriptor.
Expand All @@ -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<storage::index const>)
[[nodiscard]] ::takatori::descriptor::relation operator()(std::shared_ptr<storage::index const> declaration);
/// @copydoc index(::takatori::util::maybe_shared_ptr<storage::index const>)
[[nodiscard]] ::takatori::descriptor::relation operator()(::takatori::util::maybe_shared_ptr<storage::index const> declaration);

/// @copydoc exchange()
[[nodiscard]] ::takatori::descriptor::relation operator()(::takatori::plan::exchange const& declaration);
Expand All @@ -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<schema::declaration const>)
[[nodiscard]] ::takatori::descriptor::schema operator()(std::shared_ptr<schema::declaration const> declaration);
/// @copydoc schema(::takatori::util::maybe_shared_ptr<schema::declaration const>)
[[nodiscard]] ::takatori::descriptor::schema operator()(::takatori::util::maybe_shared_ptr<schema::declaration const> declaration);

/// @copydoc schema(schema::declaration&&)
[[nodiscard]] ::takatori::descriptor::schema operator()(schema::declaration&& declaration);
Expand Down
10 changes: 6 additions & 4 deletions src/yugawara/binding/factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<index_info>(declaration));
}

::takatori::descriptor::relation factory::index(std::shared_ptr<storage::index const> declaration) {
::takatori::descriptor::relation factory::index(maybe_shared_ptr<storage::index const> declaration) {
return wrap(std::make_shared<index_info>(std::move(declaration)));
}

Expand Down Expand Up @@ -89,7 +91,7 @@ ::takatori::descriptor::aggregate_function factory::aggregate_function(aggregate
return aggregate_function(std::make_shared<aggregate::declaration>(std::move(declaration)));
}

::takatori::descriptor::schema factory::schema(std::shared_ptr<schema::declaration const> declaration) {
::takatori::descriptor::schema factory::schema(maybe_shared_ptr<schema::declaration const> declaration) {
return wrap(std::make_shared<schema_info>(std::move(declaration)));
}

Expand All @@ -109,7 +111,7 @@ ::takatori::descriptor::relation factory::operator()(storage::index const& decla
return index(declaration);
}

::takatori::descriptor::relation factory::operator()(std::shared_ptr<storage::index const> declaration) {
::takatori::descriptor::relation factory::operator()(maybe_shared_ptr<storage::index const> declaration) {
return index(std::move(declaration));
}

Expand Down Expand Up @@ -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<schema::declaration const> declaration) {
::takatori::descriptor::schema factory::operator()(maybe_shared_ptr<schema::declaration const> declaration) {
return schema(std::move(declaration));
}

Expand Down

0 comments on commit d7f83ed

Please sign in to comment.