17 #ifndef HH_SENF_Packets_GenericTLV_ 18 #define HH_SENF_Packets_GenericTLV_ 1 21 #include <boost/ptr_container/ptr_map.hpp> 123 template <
class Base>
125 :
private detail::GenericTLVParserBaseTag,
137 template <
class Parser>
140 template <
class Parser>
143 template <
class Parser>
148 void dump(std::ostream & os)
const;
151 template<
class ForwardReadableRange>
152 void value(ForwardReadableRange
const & val,
155 template<
class First,
class Second>
156 void value(std::pair<First, Second>
const & val,
157 typename boost::disable_if<boost::is_convertible<First, typename Base::type_t::value_type> >::type * = 0);
159 template <
class Type,
class ForwardReadableRange>
160 void value(std::pair<Type, ForwardReadableRange>
const & val,
161 typename boost::enable_if<boost::is_convertible<Type, typename Base::type_t::value_type> >::type * = 0);
163 template<
class ForwardReadableRange>
164 void value(ForwardReadableRange
const & val);
166 template <
class ForwardReadableRange>
167 void value(std::pair<typename Base::type_t::value_type, ForwardReadableRange>
const & val);
171 template<
class ForwardReadableRange>
172 void value_(ForwardReadableRange
const &range);
175 Base
const &
self()
const;
226 template <
class BaseParser,
class Keytype =
typename BaseParser::type_t::value_type>
228 :
public singleton<GenericTLVParserRegistry<BaseParser,Keytype> >
232 typedef boost::ptr_map<Keytype,
233 detail::GenericTLVParserRegistry_EntryBase<BaseParser> > Map;
240 template <
class PacketParser>
245 template <
typename Parser>
246 void registerParser();
251 bool isRegistered(Keytype
const & key)
const;
253 void dump(GenericTLVParser
const & parser, std::ostream & os)
const;
254 void dump(GenericTLVParser
const & parser, Keytype
const & key, std::ostream & os)
const;
260 const_iterator begin()
const;
261 const_iterator end()
const;
270 template <
class ListPolicy>
278 template <
typename TLVParser>
280 bool contains(
typename ListPolicy::element_type::type_t::value_type typeId)
const;
282 template <
typename TLVParser>
283 TLVParser find()
const;
295 # define SENF_PACKET_TLV_REGISTRY_REGISTER( ConreteTLVParser ) \ 297 ConreteTLVParser::Registry::RegistrationProxy<ConreteTLVParser> \ 298 BOOST_PP_CAT(tlvparserRegistration_, __LINE__); \ 301 # define SENF_PARSER_TLV_LIST SENF_PARSER_LIST
TLV parser registration facility.
Return number of bytes to allocate to new object of given type.
bool contains(InputIterator first, InputIterator last, ValueType const &value)
void dump(std::ostream &os) const
Base class for generic TLV parsers.
raw_container::const_iterator const_iterator
GenericTLVParserBase< BaseParser > GenericTLVParser
TLVParserNotRegisteredException()
Map::const_iterator const_iterator
Packet data STL-sequence view.
detail::packet::size_type size_type
Unsigned integral type.
PacketInterpreterBase::range value() const
boost::iterator_range< iterator > range
Arbitrary sequential element collection.
detail::packet::iterator data_iterator
Raw data iterator type.
GenericTLVParserBase(PacketParserBase::data_iterator i, PacketParserBase::state_type s)
PacketParserBase::size_type bytes() const