TLV parser registration facility. More...
#include <senf/Packets/GenericTLV.hh>
Classes | |
struct | RegistrationProxy |
Public Types | |
typedef GenericTLVParserBase< BaseParser > | GenericTLVParser |
typedef Map::const_iterator | const_iterator |
Public Member Functions | |
template<typename Parser > | |
void | registerParser () |
bool | isRegistered (GenericTLVParserBase< BaseParser > const &parser) const |
bool | isRegistered (Keytype const &key) const |
void | dump (GenericTLVParser const &parser, std::ostream &os) const |
void | dump (GenericTLVParser const &parser, Keytype const &key, std::ostream &os) const |
PacketParserBase::size_type | bytes (GenericTLVParser const &parser) const |
PacketParserBase::size_type | bytes (GenericTLVParser const &parser, Keytype const &key) const |
const_iterator | begin () const |
const_iterator | end () const |
Additional Inherited Members | |
Protected Member Functions inherited from senf::singleton< GenericTLVParserRegistry< BaseParser, Keytype > > | |
singleton () | |
~singleton () | |
Static Protected Member Functions inherited from senf::singleton< GenericTLVParserRegistry< BaseParser, Keytype > > | |
static Self & | instance () |
static bool | alive () |
TLV parser registration facility.
The GenericTLVParserRegistry provides a generic facility to globally register concrete TLV parser by the type value. The concrete TLV parser must therefore provide a typeId
member. See GenericTLVParserBase for details about the assumed class structure.
Every registry is identified by the base tlv parser class. Parsers can be registered statically only:
This global variable declaration will register ConcreteTLVParser. The variable registerConcreteTLVParser is a dummy. It's only function is to force the call of it's constructor during global construction time. This static registration only works when the symbol is included into the final binary.
To simplify the registration the SENF_PACKET_TLV_REGISTRY_REGISTER macro can be used. The ConreteTLVParser
must therefore provide a Registry
typedef pointing to the GenericTLVParserRegistry; typically you put this typedef to the TLVBaseParser class.
The registry provides a dump() member to dump an instance of a generic TLV parser. If the type value of the given TLV parser is registered the generic tlv will be casted to the registered concrete TLV parser and the dump member from this parser will be called. \see GenericTLVParserBase for the general TLV class structure \n IPv6OptionParser::Registry, WLANInfoElementParser::Registry, MIHBaseTLVParser::Registry
Definition at line 227 of file GenericTLV.hh.
typedef Map::const_iterator senf::GenericTLVParserRegistry< BaseParser, Keytype >::const_iterator |
Definition at line 259 of file GenericTLV.hh.
typedef GenericTLVParserBase<BaseParser> senf::GenericTLVParserRegistry< BaseParser, Keytype >::GenericTLVParser |
Definition at line 248 of file GenericTLV.hh.
const_iterator senf::GenericTLVParserRegistry< BaseParser, Keytype >::begin | ( | ) | const |
PacketParserBase::size_type senf::GenericTLVParserRegistry< BaseParser, Keytype >::bytes | ( | GenericTLVParser const & | parser | ) | const |
PacketParserBase::size_type senf::GenericTLVParserRegistry< BaseParser, Keytype >::bytes | ( | GenericTLVParser const & | parser, |
Keytype const & | key | ||
) | const |
void senf::GenericTLVParserRegistry< BaseParser, Keytype >::dump | ( | GenericTLVParser const & | parser, |
std::ostream & | os | ||
) | const |
void senf::GenericTLVParserRegistry< BaseParser, Keytype >::dump | ( | GenericTLVParser const & | parser, |
Keytype const & | key, | ||
std::ostream & | os | ||
) | const |
const_iterator senf::GenericTLVParserRegistry< BaseParser, Keytype >::end | ( | ) | const |
bool senf::GenericTLVParserRegistry< BaseParser, Keytype >::isRegistered | ( | GenericTLVParserBase< BaseParser > const & | parser | ) | const |
bool senf::GenericTLVParserRegistry< BaseParser, Keytype >::isRegistered | ( | Keytype const & | key | ) | const |
void senf::GenericTLVParserRegistry< BaseParser, Keytype >::registerParser | ( | ) |