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

ListNParser.cti

Go to the documentation of this file.
00001 // $Id: ListNParser.cti 1742 2010-11-04 14:51:56Z g0dil $
00002 //
00003 // Copyright (C) 2007
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 "ListNParser.ih"
00027 
00028 // Custom includes
00029 
00030 #define prefix_ inline
00031 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00032 
00033 template <class ElementParser, class AuxPolicy>
00034 prefix_ senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::ListNParser_Policy()
00035 {}
00036 
00037 template <class ElementParser, class AuxPolicy>
00038 prefix_ senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::
00039 ListNParser_Policy(parser_policy const & policy)
00040   : AuxPolicy(policy)
00041 {}
00042 
00043 template <class ElementParser, class AuxPolicy>
00044 template <class Arg>
00045 prefix_
00046 senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::ListNParser_Policy(Arg const & aux)
00047     : AuxPolicy (aux)
00048 {}
00049 
00050 template <class ElementParser, class AuxPolicy>
00051 prefix_ typename senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::size_type
00052 senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::bytes(data_iterator i, state_type s)
00053     const
00054 {
00055     container_type c (parser_type(*this, i, s));
00056     return std::distance(i,c.end().raw());
00057 }
00058 
00059 template <class ElementParser, class AuxPolicy>
00060 prefix_ typename senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::size_type
00061 senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::size(data_iterator i, state_type s)
00062     const
00063 {
00064     return AuxPolicy::aux(i,s);
00065 }
00066 
00067 template <class ElementParser, class AuxPolicy>
00068 prefix_ void senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::init(data_iterator i,
00069                                                                              state_type s)
00070     const
00071 {
00072     AuxPolicy::aux(0,i,s);
00073 }
00074 
00075 template <class ElementParser, class AuxPolicy>
00076 prefix_ void
00077 senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::construct(container_type & c)
00078     const
00079 {}
00080 
00081 template <class ElementParser, class AuxPolicy>
00082 prefix_ void
00083 senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::destruct(container_type & c)
00084     const
00085 {}
00086 
00087 template <class ElementParser, class AuxPolicy>
00088 prefix_ void
00089 senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::erase(container_type & c,
00090                                                                  data_iterator p)
00091     const
00092 {
00093     this->aux(this->aux(c.i(),c.state())-1,c.i(),c.state());
00094 }
00095 
00096 template <class ElementParser, class AuxPolicy>
00097 prefix_ void
00098 senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::insert(container_type & c,
00099                                                                   data_iterator p)
00100     const
00101 {
00102     this->aux(this->aux(c.i(),c.state())+1,c.i(),c.state());
00103 }
00104 
00105 template <class ElementParser, class AuxPolicy>
00106 prefix_ void
00107 senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::update(container_type const & c)
00108     const
00109 {}
00110 
00111 template <class ElementParser, class AuxPolicy>
00112 prefix_ typename senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::data_iterator
00113 senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::setBegin(container_type const & c,
00114                                                                     iterator_data & d)
00115     const
00116 {
00117     d.n_ = this->aux(c.i(),c.state());
00118     return d.n_ ? this->adjust(c.i(),c.state()) : c.data().end();
00119 }
00120 
00121 template <class ElementParser, class AuxPolicy>
00122 prefix_ typename senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::data_iterator
00123 senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::setEnd(container_type const & c,
00124                                                                   iterator_data & d)
00125     const
00126 {
00127     d.n_ = 0;
00128     return c.data().end();
00129 }
00130 
00131 template <class ElementParser, class AuxPolicy>
00132 prefix_ typename senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::data_iterator
00133 senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::next(container_type const & c,
00134                                                                 iterator_data & d)
00135     const
00136 {
00137     --d.n_;
00138     return d.n_ ? boost::next( container_type::iterator::get(d).i(),
00139                                senf::bytes(* container_type::iterator::get(d)) )
00140         : c.data().end();
00141 }
00142 
00143 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00144 #undef prefix_
00145 
00146 
00147 // Local Variables:
00148 // mode: c++
00149 // fill-column: 100
00150 // comment-column: 40
00151 // c-file-style: "senf"
00152 // indent-tabs-mode: nil
00153 // ispell-local-dictionary: "american"
00154 // compile-command: "scons -u test"
00155 // End:

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