Goby3  3.1.5a
2024.05.23
moos_protobuf_helpers.h File Reference
#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <iomanip>
#include <limits>
#include <map>
#include <memory>
#include <mutex>
#include <regex>
#include <sstream>
#include <stdexcept>
#include <string>
#include <utility>
#include <vector>
#include <boost/algorithm/string/case_conv.hpp>
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/erase.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/trim.hpp>
#include <boost/core/enable_if.hpp>
#include <boost/format.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/lexical_cast/bad_lexical_cast.hpp>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/message.h>
#include <google/protobuf/text_format.h>
#include "dccl/dynamic_protobuf_manager.h"
#include "goby/moos/moos_string.h"
#include "goby/moos/protobuf/goby_moos_app.pb.h"
#include "goby/moos/protobuf/translator.pb.h"
#include "goby/moos/transitional/message_algorithms.h"
#include "goby/moos/transitional/message_val.h"
#include "goby/util/as.h"
#include "goby/util/binary.h"
#include "goby/util/debug_logger/flex_ostream.h"
#include "goby/util/debug_logger/flex_ostreambuf.h"

Go to the source code of this file.

Classes

class  goby::moos::MOOSTranslation< technique >
 
class  goby::moos::MOOSTranslation< protobuf::TranslatorEntry::TECHNIQUE_PROTOBUF_TEXT_FORMAT >
 
class  goby::moos::MOOSTranslation< protobuf::TranslatorEntry::TECHNIQUE_PROTOBUF_NATIVE_ENCODED >
 
class  goby::moos::MOOSTranslation< protobuf::TranslatorEntry::TECHNIQUE_PROTOBUF_NATIVE_HEX >
 
class  goby::moos::MOOSPrefixTranslation< prefix_technique, base_technique >
 
class  goby::moos::MOOSTranslation< protobuf::TranslatorEntry::TECHNIQUE_PREFIXED_PROTOBUF_TEXT_FORMAT >
 
class  goby::moos::MOOSTranslation< protobuf::TranslatorEntry::TECHNIQUE_PREFIXED_PROTOBUF_NATIVE_ENCODED >
 
class  goby::moos::MOOSTranslation< protobuf::TranslatorEntry::TECHNIQUE_PREFIXED_PROTOBUF_NATIVE_HEX >
 
class  goby::moos::MOOSTranslation< protobuf::TranslatorEntry::TECHNIQUE_COMMA_SEPARATED_KEY_EQUALS_VALUE_PAIRS >
 
class  goby::moos::MOOSTranslation< protobuf::TranslatorEntry::TECHNIQUE_FORMAT >
 
struct  goby::moos::MOOSTranslation< protobuf::TranslatorEntry::TECHNIQUE_FORMAT >::RepeatedFieldKey
 

Namespaces

 goby
 The global namespace for the Goby project.
 
 goby::moos
 

Functions

std::map< int, std::string > goby::moos::run_serialize_algorithms (const google::protobuf::Message &in, const google::protobuf::RepeatedPtrField< protobuf::TranslatorEntry::PublishSerializer::Algorithm > &algorithms)
 
std::string goby::moos::strip_name_from_enum (const std::string &enum_value, const std::string &field_name)
 
std::string goby::moos::add_name_to_enum (const std::string &enum_value, const std::string &field_name)
 
goby::moos::protobuf::TranslatorEntry::ParserSerializerTechnique goby::moos::get_moos_technique ()
 
void goby::moos::set_moos_technique (const goby::moos::protobuf::GobyMOOSAppConfig &cfg)
 
bool serialize_for_moos (std::string *out, const google::protobuf::Message &msg)
 Converts the Google Protocol Buffers message msg into a suitable (human readable) string out for sending via MOOS. More...
 
void parse_for_moos (const std::string &in, google::protobuf::Message *msg)
 Parses the string in to Google Protocol Buffers message msg. All errors are written to the goby::util::glogger(). More...
 
std::shared_ptr< google::protobuf::Messagedynamic_parse_for_moos (const std::string &in)
 

Variables

std::mutex goby::moos::dynamic_parse_mutex
 
const std::string goby::moos::MAGIC_PROTOBUF_HEADER = "@PB"
 
std::mutex goby::moos::moos_technique_mutex
 
goby::moos::protobuf::TranslatorEntry::ParserSerializerTechnique goby::moos::moos_technique
 

Detailed Description

Helpers for MOOS applications for serializing and parsed Google Protocol buffers messages

Definition in file moos_protobuf_helpers.h.

Function Documentation

◆ dynamic_parse_for_moos()

std::shared_ptr<google::protobuf::Message> dynamic_parse_for_moos ( const std::string &  in)
inline

Definition at line 1628 of file moos_protobuf_helpers.h.

◆ parse_for_moos()

void parse_for_moos ( const std::string &  in,
google::protobuf::Message msg 
)
inline

Parses the string in to Google Protocol Buffers message msg. All errors are written to the goby::util::glogger().

Parameters
instd::string to parse
msgGoogle Protocol buffers message to store result

Definition at line 1584 of file moos_protobuf_helpers.h.

◆ serialize_for_moos()

bool serialize_for_moos ( std::string *  out,
const google::protobuf::Message msg 
)
inline

Converts the Google Protocol Buffers message msg into a suitable (human readable) string out for sending via MOOS.

Parameters
outpointer to std::string to store serialized result
msgGoogle Protocol buffers message to serialize

Definition at line 1538 of file moos_protobuf_helpers.h.