X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senf%2FPackets%2FGenericTLV.ct;h=44b748d9c894322cae199cb20d7f11692a888397;hb=6c0332484574ed1cb571bbc0dc9f0a37d6653282;hp=9c364318ca5fd6636301da65e329bddbf66367ba;hpb=cf48e83de9d4793ca5bd67d1e5acdb5b20968638;p=senf.git diff --git a/senf/Packets/GenericTLV.ct b/senf/Packets/GenericTLV.ct index 9c36431..44b748d 100644 --- a/senf/Packets/GenericTLV.ct +++ b/senf/Packets/GenericTLV.ct @@ -60,18 +60,6 @@ prefix_ senf::PacketInterpreterBase::range senf::GenericTLVParserBase::va } template -prefix_ void senf::GenericTLVParserBase::dump(std::ostream & os) - const -{ - boost::io::ios_all_saver ias(os); - os << "GenericTLVParser<" << prettyName(typeid(Base)) << ">\n" - << " type: " << senf::format::dumpint(this->type()) << "\n" - << " length: " << senf::format::dumpint(this->length()) << "\n" - << " value:\n"; - hexdump(value().begin(), value().end(), os); -} - -template template prefix_ void senf::GenericTLVParserBase::value_(ForwardReadableRange const &range) { @@ -92,22 +80,27 @@ template template prefix_ void senf::GenericTLVParserRegistry::registerParser() { - typename Map::iterator i (map_.find( Parser::typeId )); - if (i == map_.end() ) { - typename BaseParser::type_t::value_type k (Parser::typeId); - map_.insert(k , new detail::GenericTLVParserRegistry_Entry() ); - } + typename BaseParser::type_t::value_type key (Parser::typeId+0); + typename Map::iterator i (map_.find( key )); + if (i == map_.end() ) + map_.insert(key, new detail::GenericTLVParserRegistry_Entry() ); } template prefix_ void senf::GenericTLVParserRegistry::dump( - std::ostream & os, GenericTLVParserBase const & parser) + GenericTLVParserBase const & parser, std::ostream & os) { typename Map::iterator i (map_.find( parser.type())); - if (i == map_.end()) - parser.dump(os); + if (i == map_.end()) { + boost::io::ios_all_saver ias(os); + os << " GenericTLVParser<" << prettyName(typeid(BaseParser)) << ">\n" + << " type: " << senf::format::dumpint(parser.type()) << "\n" + << " length: " << senf::format::dumpint(parser.length()) << "\n" + << " value:\n"; + hexdump(parser.value().begin(), parser.value().end(), os); + } else - (i->second)->dump(os, parser); + (i->second)->dump(parser, os); } ///////////////////////////////ct.e////////////////////////////////////////