24#ifndef GOBY_MIDDLEWARE_MARSHALLING_DETAIL_DCCL_SERIALIZER_PARSER_H
25#define GOBY_MIDDLEWARE_MARSHALLING_DETAIL_DCCL_SERIALIZER_PARSER_H
32#include <unordered_map>
35#include <dccl/codec.h>
36#include <dccl/dynamic_protobuf_manager.h>
55class SerializerProtobufMetadata;
64 static std::unique_ptr<dccl::Codec> codec_;
90 const google::protobuf::Descriptor* desc_;
93 static std::unordered_map<const google::protobuf::Descriptor*, std::unique_ptr<LoaderBase>>
100 const auto* desc = DataType::descriptor();
106 static void check_load(
const google::protobuf::Descriptor* desc)
110 std::make_pair(desc, std::unique_ptr<LoaderBase>(
new LoaderDynamic(desc))));
117 codec_ = std::make_unique<dccl::Codec>();
123 codec_.reset(new_codec);
134 template <
typename CharIterator>
static unsigned id(CharIterator begin, CharIterator end)
137 return codec().id(begin, end);
140 static unsigned id(
const std::string& full_name)
143 auto* desc = dccl::DynamicProtobufManager::find_descriptor(full_name);
146 return codec().id(desc);
163 codec().load_library(library);
detail namespace with internal helper functions
The global namespace for the Goby project.
util::FlexOstream glog
Access the Goby logger through this object.
virtual ~LoaderBase()=default
~LoaderDynamic() override
LoaderDynamic(const google::protobuf::Descriptor *desc)
Wraps a dccl::Codec in a thread-safe way to make it usable by SerializerParserHelper.
static dccl::Codec & codec()
static std::mutex dccl_mutex_
static unsigned id(const std::string &full_name)
static constexpr int INVALID_DCCL_ID
static void check_load(const google::protobuf::Descriptor *desc)
static dccl::Codec & set_codec(dccl::Codec *new_codec)
static std::set< std::string > loaded_proto_files_
DCCLSerializerParserHelperBase()=default
static void setup_dlog()
Enable dlog output to glog using same verbosity settings as glog.
static void load_library(const std::string &library)
static void load_metadata(const goby::middleware::protobuf::SerializerProtobufMetadata &meta)
static std::unordered_map< const google::protobuf::Descriptor *, std::unique_ptr< LoaderBase > > loader_map_
static goby::middleware::intervehicle::protobuf::DCCLForwardedData unpack(const std::string &bytes)
virtual ~DCCLSerializerParserHelperBase()=default
static unsigned id(CharIterator begin, CharIterator end)