X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senf%2FPackets%2FGenericTLV.hh;h=b1298e0ce66dbe5bedde2affc29e649d17950077;hb=9762e8c5d2f6c1264ba97acd3e589f6fa8f522c6;hp=e6f798a3b84bd811cb89a02f2174a2daff5aab55;hpb=52ceda9d4019d45ef0d1a941d517b4ffeafe547b;p=senf.git diff --git a/senf/Packets/GenericTLV.hh b/senf/Packets/GenericTLV.hh index e6f798a..b1298e0 100644 --- a/senf/Packets/GenericTLV.hh +++ b/senf/Packets/GenericTLV.hh @@ -193,6 +193,16 @@ namespace senf { { virtual void dump(GenericTLVParserBase const & parser, std::ostream & os) const; }; + + //Helper Functor for STL-compatible predicate (E.g. find_if, for_each ...) + template + class Predicate + { + public: + const bool operator() (BaseParser const &p) const{ + return p.template is(); + } + }; } /** \brief TLV parser registration facility @@ -243,19 +253,18 @@ namespace senf { IPv6OptionParser::Registry, WLANInfoElementParser::Registry, MIHBaseTLVParser::Registry */ - template + template class GenericTLVParserRegistry - : public senf::singleton > + : public senf::singleton > { - typedef boost::ptr_map< - typename BaseParser::type_t::value_type, + typedef boost::ptr_map > Map; Map map_; GenericTLVParserRegistry() {}; public: - using senf::singleton >::instance; - friend class senf::singleton >; + using senf::singleton >::instance; + friend class senf::singleton >; template struct RegistrationProxy { @@ -265,7 +274,11 @@ namespace senf { template void registerParser(); + bool isRegistered(GenericTLVParserBase const & parser) const; + bool isRegistered(Keytype const & key) const; + void dump(GenericTLVParserBase const & parser, std::ostream & os) const; + void dump(GenericTLVParserBase const & parser, Keytype const & key, std::ostream & os) const; }; /** \brief Statically add an entry to a TLV parser registry