Packets: Completely restructured #includes, introduced central Packets.hh file
[senf.git] / Packets / ParseArray.hh
1 // $Id$
2 //
3 // Copyright (C) 2006
4 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
5 // Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
6 //     Stefan Bund <stefan.bund@fokus.fraunhofer.de>
7 //
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
12 //
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 // GNU General Public License for more details.
17 //
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the
20 // Free Software Foundation, Inc.,
21 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22
23 #ifndef HH_ParseArray_
24 #define HH_ParseArray_ 1
25
26 // Custom includes
27 #include "PacketParser.hh"
28
29 //#include "ParseArray.mpp"
30 ///////////////////////////////hh.p////////////////////////////////////////
31
32 namespace senf {
33
34     namespace detail { template <class> class Parse_Array_iterator; }
35
36     /* Parse_Array has the external interface of a container class
37      */
38     template <unsigned elements, class ElementParser>
39     struct Parse_Array : public PacketParserBase
40     {
41         Parse_Array(data_iterator i, state_type s);
42
43         static size_type const fixed_bytes = elements*ElementParser::fixed_bytes;
44
45         void init() const;
46
47         ///////////////////////////////////////////////////////////////////////////
48         // Container interface
49
50         typedef ElementParser value_type;
51         typedef detail::Parse_Array_iterator<value_type> iterator;
52         typedef iterator const_iterator;
53
54         static size_type size();
55
56         iterator begin() const;
57         iterator end() const;
58
59         value_type operator[](difference_type i) const;
60     };
61
62 }
63
64 ///////////////////////////////hh.e////////////////////////////////////////
65 #endif
66 #if !defined(SENF_PACKETS_DECL_ONLY) && !defined(HH_ParseArray_i_)
67 #define HH_ParseArray_i_
68 //#include "ParseArray.cci"
69 //#include "ParseArray.ct"
70 #include "ParseArray.cti"
71 #endif
72
73 \f
74 // Local Variables:
75 // mode: c++
76 // fill-column: 100
77 // c-file-style: "senf"
78 // indent-tabs-mode: nil
79 // ispell-local-dictionary: "american"
80 // compile-command: "scons -u test"
81 // comment-column: 40
82 // End: