5#include <viam/sdk/common/proto_convert.hpp>
26 static API from_string(std::string api);
29 API(std::string ns, std::string resource_type, std::string resource_subtype);
31 std::string to_string()
const;
33 const std::string& type_namespace()
const;
34 const std::string& resource_type()
const;
35 const std::string& resource_subtype()
const;
37 bool is_component_type();
38 bool is_service_type();
40 friend bool operator==(
API const& lhs,
API const& rhs);
41 friend bool operator<(
const API& lhs,
const API& rhs);
43 friend std::ostream& operator<<(std::ostream& os,
const API& v);
54 std::string namespace_;
55 std::string resource_type_;
56 std::string resource_subtype_;
63 static Name from_string(std::string name);
65 Name(
API api, std::string remote_name, std::string name);
68 std::string short_name()
const;
69 std::string to_string()
const;
71 const API& api()
const;
72 const std::string& name()
const;
73 const std::string& remote_name()
const;
75 friend bool operator==(
const Name& lhs,
const Name& rhs);
76 friend std::ostream& operator<<(std::ostream& os,
const Name& v);
80 std::string remote_name_;
84namespace proto_convert_details {
88 void operator()(
const Name&, common::v1::ResourceName*)
const;
93 Name operator()(
const common::v1::ResourceName*)
const;
103 const API& api()
const;
104 const std::string& proto_service_name()
const;
110 std::string proto_service_name_;
115 ModelFamily(std::string namespace_, std::string family);
116 std::string to_string()
const;
119 std::string namespace_;
127 std::string to_string()
const;
129 Model(std::string namespace_, std::string family, std::string model_name);
138 friend bool operator==(
const Model& lhs,
const Model& rhs);
142 std::string model_name_;
151 return std::hash<std::string>()(key.to_string());
158 const ::viam::sdk::API& api = key.api();
159 std::string hash = api.to_string() + key.proto_service_name();
160 return std::hash<std::string>()(hash);
166 size_t operator()(const ::viam::sdk::API& key)
const noexcept {
167 return std::hash<std::string>()(key.to_string());
Definition resource_api.hpp:21
Definition resource_api.hpp:113
Defines the namespace_, family, and name for a particular resource model.
Definition resource_api.hpp:125
static Model from_str(std::string model)
Parses a single model string into a Model, using default values for namespace and family if not provi...
A name for specific instances of resources.
Definition resource_api.hpp:61
Definition resource_api.hpp:98
Definition resource.hpp:31
Definition resource_api.hpp:46
Definition proto_convert.hpp:24
Definition proto_convert.hpp:18