X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Packets%2FParseListN.hh;h=18c5f4b90406e76980a604a1931cc391cbb7a521;hb=82ad2ed94c12c3e53097fef92978de8c28239fab;hp=8dc224349061147bc1d006cfb9877a1fbb57c98e;hpb=2d6585ff852e9d282c17003ba1db0b73eb3a8500;p=senf.git diff --git a/Packets/ParseListN.hh b/Packets/ParseListN.hh index 8dc2243..18c5f4b 100644 --- a/Packets/ParseListN.hh +++ b/Packets/ParseListN.hh @@ -1,3 +1,4 @@ + // Copyright (C) 2007 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS) // Kompetenzzentrum fuer Satelitenkommunikation (SatCom) @@ -35,16 +36,46 @@ namespace senf { namespace detail { template class Parse_ListN_Policy; } + /** \brief List parser with size-field giving number of list elements + + This parser will parse a list which size is giving by a preceding field containing the + number of list elements. This struct is just a 'template typedef': + \code + senf::Parse_VectorN< Parser_UInt32, Parser_UInt16 >::parser Parse_MyVector; + senf::Parse_ListN< Parse_MyVector, Parse_UInt16 >::parser Parse_MyList; + \endcode + This first defines a Vector of 32 bit unsigned integers with 16 bit length counter. Then it + defines a list of such vectors with a 16 bit size field. + + \see Parse_List + \ingroup parsecollection + */ template struct Parse_ListN { typedef Parse_List< detail::Parse_ListN_Policy > parser; }; + /** \brief Define Parse_ListN field + + This macro is a special helper to define a senf::Parse_ListN type field, a list of elements + of type \a elt_type (a parser type) directly preceded by a numeric size field of type \a + size_type (another parser type). + + \param[in] name field name + \param[in] elt_type list element type + \param[in] size_type size type + \hideinitializer + \ingroup packetparsermacros + */ +# define SENF_PARSER_LIST_N(name, elt_type, size_type) \ + typedef senf::Parse_ListN::parser BOOST_PP_CAT(name, _list_t); \ + SENF_PARSER_FIELD( name, BOOST_PP_CAT(name, _list_t) ) + } ///////////////////////////////hh.e//////////////////////////////////////// #endif -#if !defined(SENF_PACKETS_DECL_ONLY) && !defined(HH_ParseListN_i_) +#if !defined(HH_Packets__decls_) && !defined(HH_ParseListN_i_) #define HH_ParseListN_i_ //#include "ParseListN.cci" #include "ParseListN.ct"