Fix SCons 1.2.0 build failure
[senf.git] / senf / Packets / PacketData.cci
1 // $Id$
2 //
3 // Copyright (C) 2007
4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 //     Stefan Bund <g0dil@berlios.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 /** \file
24     \brief PacketData inline non-template implementation */
25
26 // Custom includes
27 #include "../Utils/senfassert.hh"
28 #include <iterator>
29 #include "PacketImpl.hh"
30 // #include "PacketParser.hh"
31
32 #define prefix_ inline
33 ///////////////////////////////cci.p///////////////////////////////////////
34
35 ///////////////////////////////////////////////////////////////////////////
36 // senf::PacketData
37
38 prefix_ senf::detail::PacketImpl & senf::PacketData::impl()
39     const
40 {
41     SENF_ASSERT( impl_ );
42     return *impl_;
43 }
44
45 prefix_ senf::PacketData::iterator senf::PacketData::begin()
46     const
47 {
48     SENF_ASSERT(begin_ <= impl().size());
49     return boost::next(impl().begin(),begin_);
50 }
51
52 prefix_ senf::PacketData::iterator senf::PacketData::end()
53     const
54 {
55     SENF_ASSERT(end_ <= impl().size());
56     return boost::next(impl().begin(),end_);
57 }
58
59 prefix_ senf::PacketData::size_type senf::PacketData::size()
60     const
61 {
62     return end_ - begin_;
63 }
64
65 prefix_ bool senf::PacketData::empty()
66     const
67 {
68     return begin_ == end_;
69 }
70
71 prefix_ senf::PacketData::byte senf::PacketData::operator[](size_type n)
72     const
73 {
74     SENF_ASSERT( n < size() );
75     return *( boost::next(begin(),n) );
76 }
77
78 prefix_ senf::PacketData::byte & senf::PacketData::operator[](size_type n)
79 {
80     SENF_ASSERT( n < size() );
81     return *( boost::next(begin(),n) );
82 }
83
84 // Modifying the raw packet data
85
86 prefix_ void senf::PacketData::insert(iterator pos, byte v)
87 {
88     impl().insert(this,pos,v);
89 }
90
91 prefix_ void senf::PacketData::insert(iterator pos, size_type n, byte v)
92 {
93     impl().insert(this,pos,n,v);
94 }
95
96 prefix_ void senf::PacketData::erase(iterator pos)
97 {
98     impl().erase(this,pos);
99 }
100
101 prefix_ void senf::PacketData::erase(iterator first, iterator last)
102 {
103     impl().erase(this,first,last);
104 }
105
106 prefix_ void senf::PacketData::clear()
107 {
108     impl().clear(this);
109 }
110
111 prefix_ void senf::PacketData::reserve(size_type n)
112 {
113     impl().reserve(n + size() - impl().size());
114 }
115
116 prefix_ senf::PacketData::size_type senf::PacketData::capacity()
117     const
118 {
119     return impl().capacity() - (impl().size() - size());
120 }
121
122 prefix_ bool senf::PacketData::valid()
123 {
124     return impl_;
125 }
126
127 // protected members
128
129 prefix_ senf::PacketData::PacketData(size_type b, size_type e)
130     : impl_(), begin_(b), end_(e)
131 {}
132
133 ///////////////////////////////cci.e///////////////////////////////////////
134 #undef prefix_
135
136 \f
137 // Local Variables:
138 // mode: c++
139 // fill-column: 100
140 // c-file-style: "senf"
141 // indent-tabs-mode: nil
142 // ispell-local-dictionary: "american"
143 // compile-command: "scons -u test"
144 // comment-column: 40
145 // End: