delphyne_gui
Message Class Reference

Detailed Description

Holds the information of a google::protobuf::Message to be consumed by a Qt widget.

Holds a variant when it is a leaf node in the message tree (

See also
Message::Variant ). Otherwise, when it is a compound type, it populates a dictionary of Messages. See Parse() implementation for a full description of how it uses the reflection API in Google Protobuf Message class to get the information of each field.

#include <visualizer/topic_interface_plugin/message.h>

Classes

struct  EnumValue
 Wraps an enumeration field in Google Protobuf. More...
 

Public Types

using Variant = std::variant< double, float, int64_t, int32_t, uint32_t, uint64_t, bool, std::string, EnumValue >
 It simplifies the operation by consumers when dealing with the type. More...
 

Public Member Functions

template<typename T >
 Message (const std::string &_name, T _value, bool _isRepeated)
 Constructs a Message. More...
 
std::string Name () const
 
std::string TypeName () const
 
bool IsCompound () const
 
Variant Value () const
 
bool IsRepeated () const
 
const std::map< std::string, std::unique_ptr< Message > > & Children () const
 

Member Typedef Documentation

◆ Variant

using Variant = std::variant<double, float, int64_t, int32_t, uint32_t, uint64_t, bool, std::string, EnumValue>

It simplifies the operation by consumers when dealing with the type.

An instance is well-constructed iff none or just one field has a value.

Constructor & Destructor Documentation

◆ Message()

Message ( const std::string &  _name,
_value,
bool  _isRepeated 
)

Constructs a Message.

It is a template constuctor that behaves differently based on T. When T is one of the possible Variant's types, it just stores the value in variantValue. When it is a pointer (it'll compile only for google::protobuf::Message*) it'll forward a copy of _value to Parse() nodes.

Parameters
_nameThe message name. The fully qualified attribute name will be used when it is recursively built.
_valueThe value to hold. When it is a pointer, it is assumed to be a google::protobuf::Message* which will request a recursive introspection via Parse() to populate children.
_isRepeatedWhether or not this message is a repeated field in a google::protobuf::Message definition.

Member Function Documentation

◆ Children()

const std::map<std::string, std::unique_ptr<Message> >& Children ( ) const
Returns
The children dictionary.

◆ IsCompound()

bool IsCompound ( ) const
Returns
Whether this type is compound or not.

◆ IsRepeated()

bool IsRepeated ( ) const
Returns
Whether the message is a repeated value of a type at the certain level in the hierarchy.

◆ Name()

std::string Name ( ) const
Returns
The full name of this item in the proto message hierarchy. It uses "::" to separate field names and injects "::X::" where X is a non-negative number to differentiate repeated fields.

◆ TypeName()

std::string TypeName ( ) const
Returns
The type name of the message.

◆ Value()

Variant Value ( ) const
Returns
The value this message holds.

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