Specifies that a type is capable of protobuf serialization and deserialization.
More...
#include <wpi/protobuf/Protobuf.h>
template<typename T>
typename Protobuf<typename std::remove_cvref_t<T>>;
{
Protobuf<typename std::remove_cvref_t<T>>::Unpack(istream)
} -> std::same_as<std::optional<typename std::remove_cvref_t<T>>>;
{
} -> std::same_as<bool>;
typename Protobuf<typename std::remove_cvref_t<T>>::MessageStruct;
{
Protobuf<typename std::remove_cvref_t<T>>::MessageStruct::msg_descriptor()
} -> std::same_as<const pb_msgdesc_t*>;
{
Protobuf<typename std::remove_cvref_t<T>>::MessageStruct::msg_name()
} -> std::same_as<std::string_view>;
{
Protobuf<typename std::remove_cvref_t<T>>::MessageStruct::file_descriptor()
} -> std::same_as<pb_filedesc_t>;
}
Class for wrapping a nanopb ostream.
Definition Protobuf.h:119
Specifies that a type is capable of protobuf serialization and deserialization.
Definition Protobuf.h:251
Protobuf serialization template.
Definition Protobuf.h:36
Specifies that a type is capable of protobuf serialization and deserialization.
This is designed for serializing complex flexible data structures using code generated from a .proto file. Serialization consists of writing values into a nanopb Stream and deserialization consists of reading values from nanopb Stream.
Implementations must define a template specialization for wpi::Protobuf with T being the type that is being serialized/deserialized, with the following static members (as enforced by this concept):
- using MessageStruct = nanopb_message_struct_here: typedef to the wpilib modified nanopb message struct
- std::optional<T> Unpack(wpi::ProtoInputStream<T>&): function for deserialization
- bool Pack(wpi::ProtoOutputStream<T>&, T&& value): function for serialization
As a suggestion, 2 extra type usings can be added to simplify the stream definitions, however these are not required.
- using InputStream = wpi::ProtoInputStream<T>;
- using OutputStream = wpi::ProtoOutputStream<T>;