2 // Copyright (c) 2020 Fraunhofer Institute for Applied Information Technology (FIT)
3 // Network Research Group (NET)
4 // Schloss Birlinghoven, 53754 Sankt Augustin, GERMANY
5 // Contact: support@wiback.org
7 // This file is part of the SENF code tree.
8 // It is licensed under the 3-clause BSD License (aka New BSD License).
9 // See LICENSE.txt in the top level directory for details or visit
10 // https://opensource.org/licenses/BSD-3-Clause
15 \brief AuxParser inline template implementation */
17 //#include "AuxParser.ih"
21 #define prefix_ inline
22 //-/////////////////////////////////////////////////////////////////////////////////////////////////
24 //-/////////////////////////////////////////////////////////////////////////////////////////////////
25 // senf::detail::PrefixAuxParserPolicy<P>
28 prefix_ typename P::value_type
29 senf::detail::PrefixAuxParserPolicy<P>::aux(PacketParserBase::data_iterator i,
30 PacketParserBase::state_type s)
33 return P(i, s).value();
37 prefix_ void senf::detail::PrefixAuxParserPolicy<P>::aux(typename P::value_type const & v,
38 PacketParserBase::data_iterator i,
39 PacketParserBase::state_type s)
46 prefix_ senf::PacketParserBase::data_iterator
47 senf::detail::PrefixAuxParserPolicy<P>::adjust(PacketParserBase::data_iterator i,
48 PacketParserBase::state_type s)
51 return i+P::fixed_bytes;
54 //-/////////////////////////////////////////////////////////////////////////////////////////////////
55 // senf::detail::FixedAuxParserPolicy<P>
57 template <class P, unsigned Dist>
58 prefix_ typename P::value_type
59 senf::detail::FixedAuxParserPolicy<P,Dist>::aux(PacketParserBase::data_iterator i,
60 PacketParserBase::state_type s)
63 return P(i-Dist, s).value();
66 template <class P, unsigned Dist>
67 prefix_ void senf::detail::FixedAuxParserPolicy<P,Dist>::aux(typename P::value_type const & v,
68 PacketParserBase::data_iterator i,
69 PacketParserBase::state_type s)
72 P(i-Dist, s).value(v);
75 template <class P, unsigned Dist>
76 prefix_ senf::PacketParserBase::data_iterator
77 senf::detail::FixedAuxParserPolicy<P,Dist>::adjust(PacketParserBase::data_iterator i,
78 PacketParserBase::state_type s)
84 //-/////////////////////////////////////////////////////////////////////////////////////////////////
85 // senf::detail::DynamicAuxParserPolicy<P>
88 prefix_ senf::detail::DynamicAuxParserPolicy<P>::DynamicAuxParserPolicy(P p)
94 senf::detail::DynamicAuxParserPolicy<P>::DynamicAuxParserPolicy(WrapperPolicy const & other)
99 prefix_ typename P::value_type
100 senf::detail::DynamicAuxParserPolicy<P>::aux(PacketParserBase::data_iterator i,
101 PacketParserBase::state_type s)
108 prefix_ void senf::detail::DynamicAuxParserPolicy<P>::aux(typename P::value_type const & v,
109 PacketParserBase::data_iterator i,
110 PacketParserBase::state_type s)
117 prefix_ senf::PacketParserBase::data_iterator
118 senf::detail::DynamicAuxParserPolicy<P>::adjust(PacketParserBase::data_iterator i,
119 PacketParserBase::state_type s)
125 //-/////////////////////////////////////////////////////////////////////////////////////////////////
126 // senf::detail::DynamicWrapperAuxParserPolicy<P>
129 prefix_ senf::detail::DynamicWrapperAuxParserPolicy<P>::
130 DynamicWrapperAuxParserPolicy(ParserPolicy const & other)
135 prefix_ typename P::value_type
136 senf::detail::DynamicWrapperAuxParserPolicy<P>::aux(PacketParserBase::data_iterator i,
137 PacketParserBase::state_type s)
145 senf::detail::DynamicWrapperAuxParserPolicy<P>::aux(typename P::value_type const & v,
146 PacketParserBase::data_iterator i,
147 PacketParserBase::state_type s)
154 prefix_ senf::PacketParserBase::data_iterator
155 senf::detail::DynamicWrapperAuxParserPolicy<P>::adjust(PacketParserBase::data_iterator i,
156 PacketParserBase::state_type s)
162 //-/////////////////////////////////////////////////////////////////////////////////////////////////
163 // senf::detail::TransformAuxParserPolicy<Policy,Transform>
165 template <class Policy, class Transform>
166 prefix_ senf::detail::TransformAuxParserPolicy<Policy,Transform>::TransformAuxParserPolicy()
169 template <class Policy, class Transform>
171 prefix_ senf::detail::TransformAuxParserPolicy<Policy,Transform>::
172 TransformAuxParserPolicy(Arg const & arg)
176 template <class Policy, class Transform>
177 prefix_ typename Transform::value_type
178 senf::detail::TransformAuxParserPolicy<Policy,Transform>::aux(PacketParserBase::data_iterator i,
179 PacketParserBase::state_type s)
182 return Transform::get(Policy::aux(i,s));
185 template <class Policy, class Transform>
186 prefix_ void senf::detail::TransformAuxParserPolicy<Policy,Transform>::
187 aux(typename Transform::value_type const & v, PacketParserBase::data_iterator i,
188 PacketParserBase::state_type s)
191 Policy::aux(Transform::set(v), i, s);
194 //-/////////////////////////////////////////////////////////////////////////////////////////////////
201 // comment-column: 40
202 // c-file-style: "senf"
203 // indent-tabs-mode: nil
204 // ispell-local-dictionary: "american"
205 // compile-command: "scons -u test"