4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 // Stefan Bund <g0dil@berlios.de>
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.
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.
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.
24 \brief PacketData inline non-template implementation */
27 #include <senf/Utils/senfassert.hh>
29 #include "PacketImpl.hh"
30 // #include "PacketParser.hh"
32 #define prefix_ inline
33 ///////////////////////////////cci.p///////////////////////////////////////
35 ///////////////////////////////////////////////////////////////////////////
38 prefix_ senf::detail::PacketImpl & senf::PacketData::impl()
43 "Internal failure: PacketData (PacketInterpreter) instance not part of any Packet?");
47 prefix_ senf::PacketData::iterator senf::PacketData::begin()
50 SENF_ASSERT(begin_ <= impl().size(),
51 "Internal failure: PacketInterpreter range outside of data container");
52 return boost::next(impl().begin(),begin_);
55 prefix_ senf::PacketData::iterator senf::PacketData::end()
58 SENF_ASSERT(end_ <= impl().size(),
59 "Internal failure: PacketInterpreter range outside of data container");
60 return boost::next(impl().begin(),end_);
63 prefix_ senf::PacketData::size_type senf::PacketData::size()
69 prefix_ bool senf::PacketData::empty()
72 return begin_ == end_;
75 prefix_ senf::PacketData::byte senf::PacketData::operator[](size_type n)
78 SENF_ASSERT( n < size(), "Access out of container range" );
79 return *( boost::next(begin(),n) );
82 prefix_ senf::PacketData::byte & senf::PacketData::operator[](size_type n)
84 SENF_ASSERT( n < size(), "Access out of container range" );
85 return *( boost::next(begin(),n) );
88 // Modifying the raw packet data
90 prefix_ void senf::PacketData::insert(iterator pos, byte v)
92 impl().insert(this,pos,v);
95 prefix_ void senf::PacketData::insert(iterator pos, size_type n, byte v)
97 impl().insert(this,pos,n,v);
100 prefix_ void senf::PacketData::erase(iterator pos)
102 impl().erase(this,pos);
105 prefix_ void senf::PacketData::erase(iterator first, iterator last)
107 impl().erase(this,first,last);
110 prefix_ void senf::PacketData::clear()
115 prefix_ void senf::PacketData::reserve(size_type n)
117 impl().reserve(n + size() - impl().size());
120 prefix_ senf::PacketData::size_type senf::PacketData::capacity()
123 return impl().capacity() - (impl().size() - size());
126 prefix_ bool senf::PacketData::valid()
133 prefix_ senf::PacketData::PacketData(size_type b, size_type e)
134 : impl_(), begin_(b), end_(e)
137 ///////////////////////////////cci.e///////////////////////////////////////
144 // c-file-style: "senf"
145 // indent-tabs-mode: nil
146 // ispell-local-dictionary: "american"
147 // compile-command: "scons -u test"
148 // comment-column: 40