Search:

SENF Extensible Network Framework

  • Home
  • Download
  • Wiki
  • BerliOS
  • ChangeLog
  • Browse SVN
  • Bug Tracker
  • Overview
  • Examples
  • HowTos
  • Glossary
  • PPI
  • Packets
  • Scheduler
  • Socket
  • Utils
  • Console
  • Daemon
  • Logger
  • Termlib
  • Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

AuxParser.cti

Go to the documentation of this file.
00001 // $Id: AuxParser.cti 1742 2010-11-04 14:51:56Z g0dil $
00002 //
00003 // Copyright (C) 2008
00004 // Fraunhofer (FOKUS)
00005 // Competence Center NETwork research (NET), St. Augustin, GERMANY
00006 //     Stefan Bund <g0dil@berlios.de>
00007 //
00008 // This program is free software; you can redistribute it and/or modify
00009 // it under the terms of the GNU General Public License as published by
00010 // the Free Software Foundation; either version 2 of the License, or
00011 // (at your option) any later version.
00012 //
00013 // This program is distributed in the hope that it will be useful,
00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016 // GNU General Public License for more details.
00017 //
00018 // You should have received a copy of the GNU General Public License
00019 // along with this program; if not, write to the
00020 // Free Software Foundation, Inc.,
00021 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00022 
00026 //#include "AuxParser.ih"
00027 
00028 // Custom includes
00029 
00030 #define prefix_ inline
00031 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00032 
00033 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00034 // senf::detail::PrefixAuxParserPolicy<P>
00035 
00036 template <class P>
00037 prefix_ typename P::value_type
00038 senf::detail::PrefixAuxParserPolicy<P>::aux(PacketParserBase::data_iterator i,
00039                                             PacketParserBase::state_type s)
00040     const
00041 {
00042     return P(i, s).value();
00043 }
00044 
00045 template <class P>
00046 prefix_ void senf::detail::PrefixAuxParserPolicy<P>::aux(typename P::value_type const & v,
00047                                                          PacketParserBase::data_iterator i,
00048                                                          PacketParserBase::state_type s)
00049     const
00050 {
00051     P(i, s).value(v);
00052 }
00053 
00054 template <class P>
00055 prefix_ senf::PacketParserBase::data_iterator
00056 senf::detail::PrefixAuxParserPolicy<P>::adjust(PacketParserBase::data_iterator i,
00057                                                PacketParserBase::state_type s)
00058     const
00059 {
00060     return i+P::fixed_bytes;
00061 }
00062 
00063 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00064 // senf::detail::FixedAuxParserPolicy<P>
00065 
00066 template <class P, unsigned Dist>
00067 prefix_ typename P::value_type
00068 senf::detail::FixedAuxParserPolicy<P,Dist>::aux(PacketParserBase::data_iterator i,
00069                                                 PacketParserBase::state_type s)
00070     const
00071 {
00072     return P(i-Dist, s).value();
00073 }
00074 
00075 template <class P, unsigned Dist>
00076 prefix_ void senf::detail::FixedAuxParserPolicy<P,Dist>::aux(typename P::value_type const & v,
00077                                                              PacketParserBase::data_iterator i,
00078                                                              PacketParserBase::state_type s)
00079     const
00080 {
00081     P(i-Dist, s).value(v);
00082 }
00083 
00084 template <class P, unsigned Dist>
00085 prefix_ senf::PacketParserBase::data_iterator
00086 senf::detail::FixedAuxParserPolicy<P,Dist>::adjust(PacketParserBase::data_iterator i,
00087                                                    PacketParserBase::state_type s)
00088     const
00089 {
00090     return i;
00091 }
00092 
00093 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00094 // senf::detail::DynamicAuxParserPolicy<P>
00095 
00096 template <class P>
00097 prefix_ senf::detail::DynamicAuxParserPolicy<P>::DynamicAuxParserPolicy(P p)
00098     : p_ (p)
00099 {}
00100 
00101 template <class P>
00102 prefix_
00103 senf::detail::DynamicAuxParserPolicy<P>::DynamicAuxParserPolicy(WrapperPolicy const & other)
00104     : p_ (* other.p_)
00105 {}
00106 
00107 template <class P>
00108 prefix_ typename P::value_type
00109 senf::detail::DynamicAuxParserPolicy<P>::aux(PacketParserBase::data_iterator i,
00110                                              PacketParserBase::state_type s)
00111     const
00112 {
00113     return p_.value();
00114 }
00115 
00116 template <class P>
00117 prefix_ void senf::detail::DynamicAuxParserPolicy<P>::aux(typename P::value_type const & v,
00118                                                           PacketParserBase::data_iterator i,
00119                                                           PacketParserBase::state_type s)
00120     const
00121 {
00122     p_.value(v);
00123 }
00124 
00125 template <class P>
00126 prefix_ senf::PacketParserBase::data_iterator
00127 senf::detail::DynamicAuxParserPolicy<P>::adjust(PacketParserBase::data_iterator i,
00128                                                 PacketParserBase::state_type s)
00129     const
00130 {
00131     return i;
00132 }
00133 
00134 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00135 // senf::detail::DynamicWrapperAuxParserPolicy<P>
00136 
00137 template <class P>
00138 prefix_ senf::detail::DynamicWrapperAuxParserPolicy<P>::
00139 DynamicWrapperAuxParserPolicy(ParserPolicy const & other)
00140     : p_ (other.p_)
00141 {}
00142 
00143 template <class P>
00144 prefix_ typename P::value_type
00145 senf::detail::DynamicWrapperAuxParserPolicy<P>::aux(PacketParserBase::data_iterator i,
00146                                                     PacketParserBase::state_type s)
00147     const
00148 {
00149     return p_->value();
00150 }
00151 
00152 template <class P>
00153 prefix_ void
00154 senf::detail::DynamicWrapperAuxParserPolicy<P>::aux(typename P::value_type const & v,
00155                                                     PacketParserBase::data_iterator i,
00156                                                     PacketParserBase::state_type s)
00157     const
00158 {
00159     p_->value(v);
00160 }
00161 
00162 template <class P>
00163 prefix_ senf::PacketParserBase::data_iterator
00164 senf::detail::DynamicWrapperAuxParserPolicy<P>::adjust(PacketParserBase::data_iterator i,
00165                                                        PacketParserBase::state_type s)
00166     const
00167 {
00168     return i;
00169 }
00170 
00171 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00172 // senf::detail::TransformAuxParserPolicy<Policy,Transform>
00173 
00174 template <class Policy, class Transform>
00175 prefix_ senf::detail::TransformAuxParserPolicy<Policy,Transform>::TransformAuxParserPolicy()
00176 {}
00177 
00178 template <class Policy, class Transform>
00179 template <class Arg>
00180 prefix_ senf::detail::TransformAuxParserPolicy<Policy,Transform>::
00181 TransformAuxParserPolicy(Arg const & arg)
00182     : Policy(arg)
00183 {}
00184 
00185 template <class Policy, class Transform>
00186 prefix_ typename Transform::value_type
00187 senf::detail::TransformAuxParserPolicy<Policy,Transform>::aux(PacketParserBase::data_iterator i,
00188                                                               PacketParserBase::state_type s)
00189     const
00190 {
00191     return Transform::get(Policy::aux(i,s));
00192 }
00193 
00194 template <class Policy, class Transform>
00195 prefix_ void senf::detail::TransformAuxParserPolicy<Policy,Transform>::
00196 aux(typename Transform::value_type const & v, PacketParserBase::data_iterator i,
00197     PacketParserBase::state_type s)
00198     const
00199 {
00200     Policy::aux(Transform::set(v), i, s);
00201 }
00202 
00203 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00204 #undef prefix_
00205 
00206 
00207 // Local Variables:
00208 // mode: c++
00209 // fill-column: 100
00210 // comment-column: 40
00211 // c-file-style: "senf"
00212 // indent-tabs-mode: nil
00213 // ispell-local-dictionary: "american"
00214 // compile-command: "scons -u test"
00215 // End:

Contact: senf-dev@lists.berlios.de | © 2006-2010 Fraunhofer Institute for Open Communication Systems, Network Research