Viam C++ SDK current
Loading...
Searching...
No Matches
impl.hpp
1#pragma once
2
3#include <vector>
4
5#include <viam/sdk/common/proto_value.hpp>
6#include <viam/sdk/resource/reconfigurable.hpp>
7
8#include "api.hpp"
9
10using namespace viam::sdk;
11
12// MyGizmo inherits from the `Gizmo` class defined in `api.hpp` and implements
13// all relevant methods along with `reconfigure`. It also specifies a static
14// `validate` method that checks config validity.
15class MyGizmo : public Gizmo, public Reconfigurable {
16 public:
17 MyGizmo(std::string name, std::string arg1) : Gizmo(std::move(name)), arg1_(std::move(arg1)){};
18 MyGizmo(const Dependencies& deps, const ResourceConfig& cfg) : Gizmo(cfg.name()) {
19 this->reconfigure(deps, cfg);
20 };
21 void reconfigure(const Dependencies& deps, const ResourceConfig& cfg) override;
22 static std::vector<std::string> validate(ResourceConfig cfg);
23
24 bool do_one(std::string arg1) override;
25 bool do_one_client_stream(std::vector<std::string> arg1) override;
26 std::vector<bool> do_one_server_stream(std::string arg1) override;
27 std::vector<bool> do_one_bidi_stream(std::vector<std::string> arg1) override;
28 std::string do_two(bool arg1) override;
29
30 private:
31 std::string arg1_;
32};
Definition api.hpp:19
Definition impl.hpp:15
void reconfigure(const Dependencies &deps, const ResourceConfig &cfg) override
Reconfigures a resource.
Definition reconfigurable.hpp:9
Definition resource.hpp:23
virtual std::string name() const
Return the resource's name.