releases/v0.0.12
Breaking change
Details and migration guide
Removes ProtoType
and AttributeMap
, replacing them with ProtoValue
and ProtoStruct
. This affects the parameter used in component doCommand
calls, as well as the extra parameter included in all component methods.
For most use cases, the change will look like this:
90246f0#diff-becf92545c215777e3fe43c17c0f4196f96bb623d3aa8feee82d1357e7c1738fL11
Namely,
- include path is now
#include <viam/sdk/common/proto_value.hpp>
- parameter is now
const ProtoStruct&
The majority of code changes will be able to just do a Replace-In-Files for the two changes above
If your component or module code actually used these types directly, the changes will look something like this:
90246f0#diff-e07f0fbd2e62063a2446d7ab99d80d9a5c50e9a94649f64b9d5caf5c67b3a345
Namely, ProtoValue
is now has value semantics rather than pointer semantics and std::shared_ptr
, and ProtoStruct
is a map of std::string
to ProtoType
. You can construct a ProtoValue
like a normal C++ class as you would, eg, a variant or JSON type:
ProtoValue num_val{5.6};
ProtoValue str_val{"meow"};
// ProtoList is a vector of ProtoValue:
ProtoList my_list{{ProtoValue{true}, ProtoValue{"meow"}, ProtoValue{6.0}}};
// ProtoStruct is a map:
ProtoStruct my_map{
{"cat", "meow"},
{"dog", "woof"},
{"number", 1.234},
{"list", my_list}, //copies my_list
};
ProtoValue
and related types now have value semantics rather than smart pointer semantics. This means, eg
map lookup operations will now use a .
rather than ->
, and types will behave like arithmetic types or standard library containers with respect to copying, moving, etc
Please see the proto_value.hpp
header for detailed documentation and API of other methods, including
to_proto
to convert togoogle::protobuf
classes, andProtoValue::from_proto
to construct fromgoogle::protobuf
classesis_a<T>
andget<T>
/get_unchecked<T>
for stored element inpection- ...or generate the doxygen documentation if you like!
To find affected code, you can grep
or ag
or GitHub code search for ProtoType
and AttributeMap
.
Additional changes
- RSDK-8828 Remove integer type from ProtoValue by @lia-viam in #292
- RSDK-8826: Conan builds in CI by @lia-viam in #296
- Fix debian builds in CI by @lia-viam in #297
- Automated Protos Update by @github-actions in #298
- Automated Protos Update by @github-actions in #300
- Use proto value get in example code by @lia-viam in #303
- RSDK-6170 - add debug log support by @stuqdog in #299
- Automated Protos Update by @github-actions in #302
- Version bump by @lia-viam in #304
Full Changelog: releases/v0.0.11...releases/v0.0.12