Skip to content

Commit

Permalink
de-inline modelregistration ctor
Browse files Browse the repository at this point in the history
  • Loading branch information
lia-viam committed Dec 18, 2024
1 parent 89bfa8b commit 03104a3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
19 changes: 19 additions & 0 deletions src/viam/sdk/registry/registry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,25 @@ ResourceServerRegistration::ResourceServerRegistration(
ResourceServerRegistration::~ResourceServerRegistration() = default;
ResourceClientRegistration::~ResourceClientRegistration() = default;

ModelRegistration::ModelRegistration(
API api,
Model model,
std::function<std::shared_ptr<Resource>(Dependencies, ResourceConfig)> constructor)
: construct_resource(std::move(constructor)),
validate(default_validator),
model_(std::move(model)),
api_(std::move(api)) {}

ModelRegistration::ModelRegistration(
API api,
Model model,
std::function<std::shared_ptr<Resource>(Dependencies, ResourceConfig)> constructor,
std::function<std::vector<std::string>(ResourceConfig)> validator)
: construct_resource(std::move(constructor)),
validate(std::move(validator)),
model_(std::move(model)),
api_(std::move(api)) {}

const API& ModelRegistration::api() const {
return api_;
};
Expand Down
12 changes: 2 additions & 10 deletions src/viam/sdk/registry/registry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,21 +72,13 @@ class ModelRegistration {
ModelRegistration(
API api,
Model model,
std::function<std::shared_ptr<Resource>(Dependencies, ResourceConfig)> constructor)
: construct_resource(std::move(constructor)),
validate(default_validator),
model_(std::move(model)),
api_(std::move(api)) {};
std::function<std::shared_ptr<Resource>(Dependencies, ResourceConfig)> constructor);

ModelRegistration(
API api,
Model model,
std::function<std::shared_ptr<Resource>(Dependencies, ResourceConfig)> constructor,
std::function<std::vector<std::string>(ResourceConfig)> validator)
: construct_resource(std::move(constructor)),
validate(std::move(validator)),
model_(std::move(model)),
api_(std::move(api)) {};
std::function<std::vector<std::string>(ResourceConfig)> validator);

const API& api() const;
const Model& model() const;
Expand Down

0 comments on commit 03104a3

Please sign in to comment.