22 #include "field_codec_manager.h"
24 std::map<google::protobuf::FieldDescriptor::Type, dccl::FieldCodecManager::InsideMap> dccl::FieldCodecManager::codecs_;
27 boost::shared_ptr<dccl::FieldCodecBase>
28 dccl::FieldCodecManager::__find(google::protobuf::FieldDescriptor::Type type,
29 const std::string& codec_name,
30 const std::string& type_name )
32 typedef InsideMap::const_iterator InsideIterator;
33 typedef std::map<google::protobuf::FieldDescriptor::Type, InsideMap>::const_iterator Iterator;
35 Iterator it = codecs_.find(type);
36 if(it != codecs_.end())
38 InsideIterator inside_it = it->second.end();
40 inside_it = it->second.find(__mangle_name(codec_name, type_name));
41 if(inside_it != it->second.end())
42 return inside_it->second;
45 inside_it = it->second.find(codec_name);
46 if(inside_it != it->second.end())
47 return inside_it->second;
50 throw(Exception(
"No codec by the name `" + codec_name +
"` found for type: " + internal::TypeHelper::find(type)->as_str()));