WPILibC++ 2024.3.2
wpi::ProtobufMessageDatabase Class Reference

Database of protobuf dynamic messages. More...

#include <wpi/protobuf/ProtobufMessageDatabase.h>

Public Member Functions

bool Add (std::string_view filename, std::span< const uint8_t > data)
 Adds a file descriptor to the database. More...
 
google::protobuf::Message * Find (std::string_view name) const
 Finds a message in the database by name. More...
 
google::protobuf::MessageFactory * GetMessageFactory ()
 Gets message factory. More...
 

Detailed Description

Database of protobuf dynamic messages.

Unlike the protobuf descriptor pools and databases, this gracefully handles adding descriptors out of order and descriptors being replaced.

Member Function Documentation

◆ Add()

bool wpi::ProtobufMessageDatabase::Add ( std::string_view  filename,
std::span< const uint8_t >  data 
)

Adds a file descriptor to the database.

If the file references other files that have not yet been added, no messages in that file will be available until those files are added. Replaces any existing file with the same name.

Parameters
filenamefilename
dataFileDescriptorProto serialized data
Returns
False if could not parse data

◆ Find()

google::protobuf::Message * wpi::ProtobufMessageDatabase::Find ( std::string_view  name) const

Finds a message in the database by name.

Parameters
nametype name
Returns
protobuf message, or nullptr if not found

◆ GetMessageFactory()

google::protobuf::MessageFactory * wpi::ProtobufMessageDatabase::GetMessageFactory ( )
inline

Gets message factory.

Returns
message factory

The documentation for this class was generated from the following file: