4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 // Stefan Bund <g0dil@berlios.de>
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the
20 // Free Software Foundation, Inc.,
21 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 \brief ListNParser public header */
26 #ifndef HH_ListNParser_
27 #define HH_ListNParser_ 1
30 #include "ListParser.hh"
32 //#include "ListNParser.mpp"
33 ///////////////////////////////hh.p////////////////////////////////////////
37 namespace detail { template <class ElementParser, class SizeParser>
38 class ListNParser_Policy; }
40 /** \brief List parser with size-field giving number of list elements
42 This parser will parse a list which size is giving by a preceding field containing the
43 number of list elements. This struct is just a 'template typedef':
45 senf::VectorNParser< Parser_UInt32, Parser_UInt16 >::parser MyVectorParser;
46 senf::ListNParser< MyVectorParser, UInt16Parser >::parser MyListParser;
48 This first defines a Vector of 32 bit unsigned integers with 16 bit length counter. Then it
49 defines a list of such vectors with a 16 bit size field.
52 \ingroup parsecollection
54 template <class ElementParser, class SizeParser>
56 typedef ListParser< detail::ListNParser_Policy<ElementParser,SizeParser> > parser;
59 /** \brief Define ListNParser field
61 This macro is a special helper to define a senf::ListNParser type field, a list of elements
62 of type \a elt_type (a parser type) directly preceded by a numeric size field of type \a
63 size_type (another parser type).
65 \param[in] name field name
66 \param[in] elt_type list element type
67 \param[in] size_type size type
69 \ingroup packetparsermacros
71 # define SENF_PARSER_LIST_N(name, elt_type, size_type) \
72 typedef senf::ListNParser<elt_type, size_type>::parser BOOST_PP_CAT(name, _list_t); \
73 SENF_PARSER_FIELD( name, BOOST_PP_CAT(name, _list_t) )
77 ///////////////////////////////hh.e////////////////////////////////////////
79 #if !defined(HH_Packets__decls_) && !defined(HH_ListNParser_i_)
80 #define HH_ListNParser_i_
81 //#include "ListNParser.cci"
82 #include "ListNParser.ct"
83 #include "ListNParser.cti"
91 // c-file-style: "senf"
92 // indent-tabs-mode: nil
93 // ispell-local-dictionary: "american"
94 // compile-command: "scons -u test"