template <class Base>
template <class Parser>
prefix_ Parser senf::GenericTLVParserBase<Base>::init()
-{
+{
senf::PacketParserBase::size_type oldSize (bytes() );
senf::PacketParserBase::size_type newParserSize ( senf::init_bytes<Parser>::value );
this->resize( oldSize, newParserSize);
template <class Base>
prefix_ void senf::GenericTLVParserBase<Base>::dump(std::ostream & os)
- const
+ const
{
if (Base::Registry::instance().isRegistered( *this)) {
Base::Registry::instance().dump( *this, os);
}
template <class Base>
-prefix_ senf::PacketInterpreterBase::range senf::GenericTLVParserBase<Base>::value()
- const
+prefix_ senf::PacketInterpreterBase::range senf::GenericTLVParserBase<Base>::value()
+ const
{
senf::PacketData::iterator begin ( boost::next(this->i(), senf::bytes( self())) );
return PacketInterpreterBase::range(begin, boost::next( begin, this->length()) );
prefix_ void senf::GenericTLVParserRegistry<BaseParser,Keytype>::registerParser()
{
Keytype key (Parser::typeId+0);
- std::cout << "GenericTLVParserRegistry::registerParser " << unsigned(key) << std::endl;
typename Map::iterator i (map_.find( key ));
if (i == map_.end() )
map_.insert(key, new detail::GenericTLVParserRegistry_Entry<BaseParser, Parser>() );
throw TLVParserNotRegisteredException();
}
-
+template <class BaseParser, class Keytype>
+prefix_ senf::PacketParserBase::size_type senf::GenericTLVParserRegistry<BaseParser,Keytype>::bytes(
+ GenericTLVParser const & parser, Keytype const & key)
+ const
+{
+ typename Map::const_iterator i (map_.find( key));
+ if (i != map_.end())
+ return (i->second)->bytes(parser);
+ else
+ throw TLVParserNotRegisteredException();
+}
+
+
///////////////////////////////ct.e////////////////////////////////////////
#undef prefix_