Ease of use wrapper to make nanopb streams more opaque to the user. More...
#include <wpi/protobuf/Protobuf.h>
Public Member Functions | |
std::optional< std::remove_cvref_t< T > > | Unpack (std::span< const uint8_t > data) |
Unpacks from a byte array. | |
bool | UnpackInto (T *out, std::span< const uint8_t > data) |
Unpacks from a byte array into an existing object. | |
bool | Pack (wpi::SmallVectorImpl< uint8_t > &out, const T &value) |
Packs object into a SmallVector. | |
bool | Pack (std::vector< uint8_t > &out, const T &value) |
Packs object into a std::vector. | |
std::string | GetTypeString () const |
Gets the type string for the message. | |
void | ForEachProtobufDescriptor (function_ref< bool(std::string_view filename)> exists, function_ref< void(std::string_view filename, std::span< const uint8_t > descriptor)> fn) |
Loops over all protobuf descriptors including nested/referenced descriptors. | |
Ease of use wrapper to make nanopb streams more opaque to the user.
This class is stateless and thread safe.
T | serialized object type |
|
inline |
Loops over all protobuf descriptors including nested/referenced descriptors.
exists | function that returns false if fn should be called for the given type string |
fn | function to call for each descriptor |
|
inline |
Gets the type string for the message.
|
inline |
Packs object into a std::vector.
[out] | out | output bytes |
[in] | value | value |
|
inline |
Packs object into a SmallVector.
[out] | out | output bytes |
[in] | value | value |
|
inline |
Unpacks from a byte array.
data | byte array |
|
inline |
Unpacks from a byte array into an existing object.
[out] | out | output object |
[in] | data | byte array |