#include <userver/ugrpc/protobuf_visit.hpp>
Collects knowledge of the structure of the protobuf messages allowing for efficient loops over nested messages to apply a callback to the ones selected by the 'selector' function.
If you do not have static knowledge of the required messages, you should use VisitMessagesRecursive that is equivalent to MessagesVisitor with a 'return true' selector.
Definition at line 244 of file protobuf_visit.hpp.
Public Types | |
using | Selector = utils::function_ref<bool(const google::protobuf::Descriptor& descriptor)> |
enum | LockBehavior |
Public Member Functions | |
MessagesVisitor (Selector selector) | |
Creates the visitor with the given selector for runtime compilation and compiles it for the message types we can find. | |
MessagesVisitor (Selector selector, const DescriptorList &descriptors) | |
Creates the visitor with the given selector and compiles it for the given message types and their fields recursively. | |
MessagesVisitor (Selector selector, LockBehavior lock_behavior) | |
Creates the visitor with custom thread locking behavior and the given selector for runtime compilation. | |
MessagesVisitor (Selector selector, const DescriptorList &descriptors, LockBehavior lock_behavior) | |
Creates the visitor with custom thread locking behavior and the given selector; compiles it for the given message types. | |
void | Compile (const google::protobuf::Descriptor *descriptor) |
Compiles the visitor for the given message type and its dependent types. | |
void | Compile (const DescriptorList &descriptors) |
Compiles the visitor for the given message types and their dependent types. | |
void | CompileGenerated (std::string_view message_name) |
Compiles the visitor for the given generated message type and its dependent types. | |
void | CompileGenerated (utils::span< std::string_view > message_names) |
Compiles the visitor for the given generated message type and their dependent types. | |
void | Visit (google::protobuf::Message &message, MessageVisitCallback callback) |
Execute a callback without recursion. | |
void | VisitRecursive (google::protobuf::Message &message, MessageVisitCallback callback) |
Execute a callback recursively. | |
using ugrpc::MessagesVisitor::Selector = utils::function_ref<bool(const google::protobuf::Descriptor& descriptor)> |
Definition at line 246 of file protobuf_visit.hpp.
|
stronginherited |
Definition at line 68 of file protobuf_visit.hpp.
ugrpc::MessagesVisitor::MessagesVisitor | ( | Selector | selector, |
LockBehavior | lock_behavior ) |
Creates the visitor with custom thread locking behavior and the given selector for runtime compilation.
ugrpc::MessagesVisitor::MessagesVisitor | ( | Selector | selector, |
const DescriptorList & | descriptors, | ||
LockBehavior | lock_behavior ) |
Creates the visitor with custom thread locking behavior and the given selector; compiles it for the given message types.
|
inlineinherited |
Compiles the visitor for the given generated message type and its dependent types.
Definition at line 90 of file protobuf_visit.hpp.
|
inlineinherited |
Compiles the visitor for the given generated message type and their dependent types.
Definition at line 94 of file protobuf_visit.hpp.
|
inherited |
Execute a callback without recursion.
Equivalent to VisitFields but utilizes the precompilation data from Compile
|
inherited |
Execute a callback recursively.
Equivalent to VisitFieldsRecursive and VisitMessagesRecursive but utilizes the precompilation data from Compile