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.ih

Go to the documentation of this file.
00001 // $Id: ListNParser.ih 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 #ifndef IH_SENF_Packets_ListNParser_
00027 #define IH_SENF_Packets_ListNParser_ 1
00028 
00029 // Custom includes
00030 #include "ListParser.ih"
00031 
00032 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00033 
00034 namespace senf {
00035 namespace detail {
00036 
00041     template <class ElementParser, class AuxPolicy>
00042     struct ListNParser_Policy
00043         : public AuxPolicy
00044     {
00045         typedef ListNParser_Policy<
00046             ElementParser, typename AuxPolicy::ParserPolicy> parser_policy;
00047         typedef ListNParser_Policy<
00048             ElementParser, typename AuxPolicy::WrapperPolicy> container_policy;
00049         typedef PacketParserBase::data_iterator data_iterator;
00050         typedef PacketParserBase::state_type state_type;
00051         typedef PacketParserBase::size_type size_type;
00052         typedef ElementParser element_type;
00053         typedef ListParser<parser_policy> parser_type;
00054         typedef ListParser_Container<container_policy> container_type;
00055 
00056         static const size_type init_bytes = AuxPolicy::aux_bytes;
00057 
00058         ListNParser_Policy();
00059         template <class Arg> ListNParser_Policy(Arg const & aux);
00060         ListNParser_Policy(parser_policy const & policy);
00061 
00062         size_type bytes  (data_iterator i, state_type s) const;
00063         size_type size   (data_iterator i, state_type s) const;
00064         void      init   (data_iterator i, state_type s) const;
00065 
00066         void      construct (container_type & c) const;
00067         void      destruct  (container_type & c) const;
00068         void      erase     (container_type & c, data_iterator p) const;
00069         void      insert    (container_type & c, data_iterator p) const;
00070         void      update    (container_type const & c) const;
00071 
00073         struct iterator_data {
00074             size_type n_;
00075         };
00076 
00077         data_iterator setBegin        (container_type const & c, iterator_data & d) const;
00078         data_iterator setEnd          (container_type const & c, iterator_data & d) const;
00079         void          setFromPosition (container_type const & c, iterator_data & d, data_iterator p) const;
00080         data_iterator next            (container_type const & c, iterator_data & d) const;
00081         data_iterator raw             (container_type const & c, iterator_data const & d) const;
00082     };
00083 
00084 #ifndef DOXYGEN
00085 
00086     template <class ElementParser, class AuxPolicy>
00087     struct ListParserPolicy<ElementParser, AuxPolicy, senf::detail::auxtag::none>
00088     {
00089         typedef ListNParser_Policy<ElementParser, AuxPolicy> type;
00090     };
00091 
00092     template <class ElementParser, class AuxPolicy, class Transform>
00093     struct ListParserPolicy<ElementParser, AuxPolicy,
00094                             senf::detail::auxtag::transform<Transform,
00095                                                             senf::detail::auxtag::none> >
00096     {
00097         typedef ListNParser_Policy< ElementParser,
00098                                     TransformAuxParserPolicy<AuxPolicy, Transform> > type;
00099     };
00100 
00101 #endif
00102 
00103 }}
00104 
00105 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00106 #endif
00107 
00108 
00109 // Local Variables:
00110 // mode: c++
00111 // fill-column: 100
00112 // comment-column: 40
00113 // c-file-style: "senf"
00114 // indent-tabs-mode: nil
00115 // ispell-local-dictionary: "american"
00116 // compile-command: "scons -u test"
00117 // End:

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