Viam C++ SDK current
Loading...
Searching...
No Matches
resource.hpp
1#pragma once
2
3#include <string>
4#include <unordered_map>
5
6#include <viam/sdk/common/proto_convert.hpp>
7#include <viam/sdk/common/proto_value.hpp>
8#include <viam/sdk/referenceframe/frame.hpp>
9#include <viam/sdk/resource/resource_api.hpp>
10
11namespace viam {
12namespace app {
13namespace v1 {
14
15class ComponentConfig;
16class ResourceLevelServiceConfig;
17
18} // namespace v1
19} // namespace app
20} // namespace viam
21
22namespace viam {
23namespace sdk {
24
26 std::string type;
27 ProtoStruct attributes;
28 ProtoValue converted_attributes;
29};
30
32 public:
33 ResourceConfig(std::string type,
34 std::string name,
35 std::string namespace_,
36 ProtoStruct attributes,
37 std::string api,
38 Model model,
39 LinkConfig frame);
40
41 ResourceConfig(std::string type);
42
43 Name resource_name();
44 const API& api() const;
45 const LinkConfig& frame() const;
46 const Model& model() const;
47 const std::string& name() const;
48 const std::string& namespace_() const;
49 const std::string& type() const;
50 const std::vector<std::string>& depends_on() const;
51 const std::vector<ResourceLevelServiceConfig>& service_config() const;
52 const ProtoStruct& attributes() const;
53
54 private:
55 API api_;
56 LinkConfig frame_;
57 Model model_;
58 std::string name_;
59 std::string namespace__;
60 std::string type_;
61 std::vector<std::string> depends_on_;
62 std::vector<ResourceLevelServiceConfig> service_config_;
63 ProtoStruct attributes_;
64 ProtoValue converted_attributes_;
65 std::vector<std::string> implicit_depends_on_;
66 void fix_api();
67};
68
69namespace proto_convert_details {
70
71template <>
73 void operator()(const ResourceLevelServiceConfig&, app::v1::ResourceLevelServiceConfig*) const;
74};
75
76template <>
78 void operator()(const ResourceConfig&, app::v1::ComponentConfig*) const;
79};
80
81template <>
82struct from_proto_impl<app::v1::ComponentConfig> {
83 ResourceConfig operator()(const app::v1::ComponentConfig*) const;
84};
85
86} // namespace proto_convert_details
87
88} // namespace sdk
89} // namespace viam
Definition resource_api.hpp:21
Definition frame.hpp:21
Defines the namespace_, family, and name for a particular resource model.
Definition resource_api.hpp:125
A name for specific instances of resources.
Definition resource_api.hpp:61
Type-erased value for storing google::protobuf::Value types. A ProtoValue can be nullptr,...
Definition proto_value.hpp:55
Definition resource.hpp:31
Definition resource.hpp:25