24 #ifndef TypeHelper20110405H
25 #define TypeHelper20110405H
31 #include "protobuf_cpp_type_helpers.h"
35 class FieldCodecManagerLocal;
46 std::shared_ptr<FromProtoTypeBase> find(google::protobuf::FieldDescriptor::Type type)
const;
47 std::shared_ptr<FromProtoCppTypeBase> find(
const google::protobuf::FieldDescriptor* field)
const
49 if (field->cpp_type() == google::protobuf::FieldDescriptor::CPPTYPE_MESSAGE)
50 return find(field->message_type());
52 return find(field->cpp_type());
55 std::shared_ptr<FromProtoCppTypeBase> find(
const google::protobuf::Descriptor* desc)
const
57 return find(google::protobuf::FieldDescriptor::CPPTYPE_MESSAGE, desc->full_name());
60 std::shared_ptr<FromProtoCppTypeBase> find(google::protobuf::FieldDescriptor::CppType cpptype,
61 const std::string& type_name =
"")
const;
64 friend class ::dccl::FieldCodecManagerLocal;
65 template <
typename ProtobufMessage>
void add()
67 custom_message_map_.insert(std::make_pair(
68 ProtobufMessage::descriptor()->full_name(),
71 template <
typename ProtobufMessage>
void remove()
73 custom_message_map_.erase(ProtobufMessage::descriptor()->full_name());
79 custom_message_map_.clear();
86 std::map<google::protobuf::FieldDescriptor::Type, std::shared_ptr<FromProtoTypeBase>>;
90 std::map<google::protobuf::FieldDescriptor::CppType, std::shared_ptr<FromProtoCppTypeBase>>;
91 CppTypeMap cpptype_map_;
93 using CustomMessageMap = std::map<std::string, std::shared_ptr<FromProtoCppTypeBase>>;
94 CustomMessageMap custom_message_map_;