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

ArrayParser.hh

Go to the documentation of this file.
00001 // $Id: ArrayParser.hh 1742 2010-11-04 14:51:56Z g0dil $
00002 //
00003 // Copyright (C) 2006
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 HH_SENF_Packets_ArrayParser_
00027 #define HH_SENF_Packets_ArrayParser_ 1
00028 
00053 // Custom includes
00054 #include "PacketParser.hh"
00055 
00056 //#include "ArrayParser.mpp"
00057 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00058 
00059 namespace senf {
00060 
00061     namespace detail { template <class> class ArrayParser_iterator; }
00062 
00074     template <unsigned elements, class ElementParser>
00075     struct ArrayParser : public PacketParserBase
00076     {
00077         ArrayParser(data_iterator i, state_type s);
00078 
00079         static size_type const fixed_bytes = elements*ElementParser::fixed_bytes;
00080 
00081         void init() const;
00082 
00083         //-////////////////////////////////////////////////////////////////////////
00084         // Container interface
00085 
00086         typedef ElementParser value_type;
00087         typedef detail::ArrayParser_iterator<value_type> iterator;
00088         typedef iterator const_iterator;
00089 
00090         static size_type size();
00091 
00092         iterator begin() const;
00093         iterator end() const;
00094 
00095         value_type operator[](difference_type i) const;
00096     };
00097 
00109 #   define SENF_PARSER_ARRAY(name, elt_type, size)                                                \
00110         typedef senf::ArrayParser<size,elt_type> BOOST_PP_CAT(name, _array_t);                    \
00111         SENF_PARSER_FIELD( name, BOOST_PP_CAT(name, _array_t) )
00112 
00113 }
00114 
00115 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00116 #endif
00117 #if !defined(HH_SENF_Packets_Packets__decls_) && !defined(HH_SENF_Packets_ArrayParser_i_)
00118 #define HH_SENF_Packets_ArrayParser_i_
00119 //#include "ArrayParser.cci"
00120 #include "ArrayParser.ct"
00121 #include "ArrayParser.cti"
00122 #endif
00123 
00124 
00125 // Local Variables:
00126 // mode: c++
00127 // fill-column: 100
00128 // c-file-style: "senf"
00129 // indent-tabs-mode: nil
00130 // ispell-local-dictionary: "american"
00131 // compile-command: "scons -u test"
00132 // comment-column: 40
00133 // End:

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