Specifies that a type is capable of protobuf serialization and deserialization.
More...
template<typename T>
google::protobuf::Arena* arena, const google::protobuf::Message& inmsg,
google::protobuf::Message* outmsg, const T& value) {
typename Protobuf<typename std::remove_cvref_t<T>>;
{
Protobuf<typename std::remove_cvref_t<T>>
::New(arena)
} -> std::same_as<google::protobuf::Message*>;
{
Protobuf<typename std::remove_cvref_t<T>>
::Unpack(inmsg)
} -> std::same_as<typename std::remove_cvref_t<T>>;
Protobuf<typename std::remove_cvref_t<T>>
::Pack(outmsg, value);
}
Specifies that a type is capable of protobuf serialization and deserialization.
Definition: Protobuf.h:65
static void Pack(std::span< uint8_t > data, const frc::DifferentialDriveWheelVoltages &value)
static google::protobuf::Message * New(google::protobuf::Arena *arena)
static frc::DifferentialDriveWheelVoltages Unpack(std::span< const uint8_t > data)
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 mutable protobuf Message and deserialization consists of reading values from an immutable protobuf Message.
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):
- google::protobuf::Message* New(google::protobuf::Arena*): create a protobuf message
- T Unpack(const google::protobuf::Message&): function for deserialization
- void Pack(google::protobuf::Message*, T&& value): function for serialization
To avoid pulling in the protobuf headers, these functions use google::protobuf::Message instead of a more specific type; implementations will need to static_cast to the correct type as created by New().
Additionally: In a static block, call StructRegistry.registerClass() to register the class