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 VariantParser internal header */
26 #ifndef IH_VariantParser_
27 #define IH_VariantParser_ 1
30 #include "PacketParser.hh"
31 #include <boost/preprocessor/cat.hpp>
32 #include <boost/preprocessor/seq/enum.hpp>
34 ///////////////////////////////ih.p////////////////////////////////////////
41 template <class Variant, unsigned N>
43 static PacketParserBase::size_type bytes(Variant const & v, unsigned n);
46 template <class Variant>
47 struct VariantBytes<Variant,0> {
48 static PacketParserBase::size_type bytes(Variant const & v, unsigned n);
51 template <class AuxPolicy, class AuxTag>
52 struct VariantParserPolicy {};
54 template <class AuxPolicy>
55 struct VariantParserPolicy<AuxPolicy, senf::detail::auxtag::none>
57 typedef AuxPolicy type;
61 template <class AuxPolicy, class Transform>
62 struct VariantParserPolicy<AuxPolicy,
63 senf::detail::auxtag::transform<Transform,
64 senf::detail::auxtag::none> >
66 typedef TransformAuxParserPolicy<AuxPolicy, Transform> type;
69 template <class Parsers>
70 struct VariantParserTraits
72 template <class AuxPolicy, class AuxTag>
74 typedef senf::VariantParser<
75 typename VariantParserPolicy<AuxPolicy, AuxTag>::type,
80 # define SENF_PARSER_VARIANT_I(access, name, chooser, types) \
81 typedef boost::mpl::vector< BOOST_PP_SEQ_ENUM(types) > BOOST_PP_CAT(name, _parsers); \
82 SENF_PARSER_REQUIRE_VAR(variant) \
83 SENF_PARSER_COLLECTION_I( \
87 senf::detail::VariantParserTraits< BOOST_PP_CAT(name, _parsers) > )
93 ///////////////////////////////ih.e////////////////////////////////////////
100 // comment-column: 40
101 // c-file-style: "senf"
102 // indent-tabs-mode: nil
103 // ispell-local-dictionary: "american"
104 // compile-command: "scons -u test"