Type-erased value for storing google::protobuf::Value types. A ProtoValue can be nullptr, bool, int, double, std::string, or, recursively, a vector or string-map of ProtoValue. This type is used at API/ABI boundaries for interfacing with grpc/proto code.
More...
#include <proto_value.hpp>
|
| ProtoValue () noexcept |
| Construct a null object.
|
|
template<typename T > |
| ProtoValue (T t) noexcept(std::is_nothrow_move_constructible< T >{}) |
| Construct a nonempty object.
|
|
| ProtoValue (const char *str) |
| Deduction helper constructor for string from string literal.
|
|
| ProtoValue (ProtoValue &&other) noexcept(proto_value_details::all_moves_noexcept{}) |
| Move construct this from other, leaving other in its unspecified-but-valid moved from state.
|
|
| ProtoValue (const ProtoValue &other) |
|
ProtoValue & | operator= (ProtoValue &&other) noexcept(proto_value_details::all_moves_noexcept{}) |
| Move assignment from other, leaving other in its unspecified-but-valid moved from state.
|
|
ProtoValue & | operator= (const ProtoValue &other) |
|
void | swap (ProtoValue &other) noexcept(proto_value_details::all_moves_noexcept{}) |
|
template<typename T > |
T const * | get () const |
|
|
int | kind () const |
| Obtain integer constant representing the stored data type.
|
|
template<typename T > |
bool | is_a () const |
| Checks whether this ProtoT is an instance of type T.
|
|
bool | is_null () const |
| Convenience version of is_a<T> to check if the value is nullptr.
|
|
template<typename T > |
T * | get () |
| Return a T pointer if this is_a<T>(), else return nullptr.
|
|
template<typename T > |
T const * | get () const |
| Return a T pointer if this is_a<T>(), else return nullptr.
|
|
|
template<typename Value = google::protobuf::Value> |
static ProtoValue | from_proto (const Value &v) |
| Construct from proto value.
|
|
Type-erased value for storing google::protobuf::Value types. A ProtoValue can be nullptr, bool, int, double, std::string, or, recursively, a vector or string-map of ProtoValue. This type is used at API/ABI boundaries for interfacing with grpc/proto code.
◆ from_proto()
template<typename Value = google::protobuf::Value>
static ProtoValue viam::sdk::ProtoValue::from_proto |
( |
const Value & | v | ) |
|
|
static |
Construct from proto value.
- Note
- This method is trivially templated to insulate google::protobuf::Value from our API/ABI. It is meant to be called with no template parameters in a translation unit which includes <google/protobuf/struct.pb.h>
◆ operator==
Test equality of two types.
- Note
- "Intuitive" arithmetic equality is not supported, but could be. Thus, bool{false}, int{0}, and double{0.0} do not compare equal.
The documentation for this class was generated from the following file: