userver: ugrpc::BaseVisitor< Callback > Class Template Reference
Loading...
Searching...
No Matches
ugrpc::BaseVisitor< Callback > Class Template Reference

#include <userver/ugrpc/protobuf_visit.hpp>

Detailed Description

template<typename Callback>
class ugrpc::BaseVisitor< Callback >

Base class for FieldsVisitor and MessagesVisitor. Provides the interface and manages the descriptor graph to enable the visitors to find all selected structures.

Definition at line 66 of file protobuf_visit.hpp.

Public Types

enum class  LockBehavior {
  kNone = 0 ,
  kShared = 1
}
 

Public Member Functions

 BaseVisitor (BaseVisitor &&)=delete
 
 BaseVisitor (const BaseVisitor &)=delete
 
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, Callback callback)
 Execute a callback without recursion.
 
void VisitRecursive (google::protobuf::Message &message, Callback callback)
 Execute a callback recursively.
 

Member Enumeration Documentation

◆ LockBehavior

template<typename Callback >
enum class ugrpc::BaseVisitor::LockBehavior
strong
Enumerator
kNone 

Do not take shared_mutex locks for any operation on the visitor.

kShared 

Take shared_lock for all read operations on the visitor and unique_lock for all Compile operations.

Definition at line 68 of file protobuf_visit.hpp.

Member Function Documentation

◆ CompileGenerated() [1/2]

template<typename Callback >
void ugrpc::BaseVisitor< Callback >::CompileGenerated ( std::string_view message_name)
inline

Compiles the visitor for the given generated message type and its dependent types.

Definition at line 90 of file protobuf_visit.hpp.

◆ CompileGenerated() [2/2]

template<typename Callback >
void ugrpc::BaseVisitor< Callback >::CompileGenerated ( utils::span< std::string_view > message_names)
inline

Compiles the visitor for the given generated message type and their dependent types.

Definition at line 94 of file protobuf_visit.hpp.

◆ Visit()

template<typename Callback >
void ugrpc::BaseVisitor< Callback >::Visit ( google::protobuf::Message & message,
Callback callback )

Execute a callback without recursion.

Equivalent to VisitFields but utilizes the precompilation data from Compile

◆ VisitRecursive()

template<typename Callback >
void ugrpc::BaseVisitor< Callback >::VisitRecursive ( google::protobuf::Message & message,
Callback callback )

Execute a callback recursively.

Equivalent to VisitFieldsRecursive and VisitMessagesRecursive but utilizes the precompilation data from Compile


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