Viam C++ SDK current
Loading...
Searching...
No Matches
impl.hpp
1#pragma once
2
3#include <vector>
4
5#include <viam/sdk/resource/reconfigurable.hpp>
6
7#include "api.hpp"
8
9using namespace viam::sdk;
10
11// MySummation inherits from the `Summation` class defined in `api.hpp` and
12// implements all relevant methods along with `reconfigure`.
13class MySummation : public Summation, public Reconfigurable {
14 public:
15 MySummation(std::string name, bool subtract)
16 : Summation(std::move(name)), subtract_(subtract){};
17 MySummation(const Dependencies& deps, const ResourceConfig& cfg) : Summation(cfg.name()) {
18 this->reconfigure(deps, cfg);
19 };
20 void reconfigure(const Dependencies& deps, const ResourceConfig& cfg) override;
21 static std::vector<std::string> validate(ResourceConfig cfg);
22
23 double sum(std::vector<double> numbers) override;
24
25 private:
26 bool subtract_;
27};
Definition impl.hpp:13
void reconfigure(const Dependencies &deps, const ResourceConfig &cfg) override
Reconfigures a resource.
Definition api.hpp:21
Definition reconfigurable.hpp:9
Definition resource.hpp:23
virtual std::string name() const
Return the resource's name.