// $Id$ // // Copyright (C) 2007 // Fraunhofer Institute for Open Communication Systems (FOKUS) // // The contents of this file are subject to the Fraunhofer FOKUS Public License // Version 1.0 (the "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // http://senf.berlios.de/license.html // // The Fraunhofer FOKUS Public License Version 1.0 is based on, // but modifies the Mozilla Public License Version 1.1. // See the full license text for the amendments. // // Software distributed under the License is distributed on an "AS IS" basis, // WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License // for the specific language governing rights and limitations under the License. // // The Original Code is Fraunhofer FOKUS code. // // The Initial Developer of the Original Code is Fraunhofer-Gesellschaft e.V. // (registered association), Hansastraße 27 c, 80686 Munich, Germany. // All Rights Reserved. // // Contributor(s): // Stefan Bund /** \file \brief PacketData inline non-template implementation */ // Custom includes #include #include #include "PacketImpl.hh" // #include "PacketParser.hh" #define prefix_ inline //-///////////////////////////////////////////////////////////////////////////////////////////////// //-///////////////////////////////////////////////////////////////////////////////////////////////// // senf::PacketData prefix_ senf::detail::PacketImpl & senf::PacketData::impl() const { SENF_ASSERT( impl_, "Internal failure: PacketData (PacketInterpreter) instance not part of any Packet?"); return *impl_; } prefix_ senf::PacketData::iterator senf::PacketData::begin() const { SENF_ASSERT(begin_ <= impl().size(), "Internal failure: PacketInterpreter range outside of data container"); return boost::next(impl().begin(),begin_); } prefix_ senf::PacketData::iterator senf::PacketData::end() const { SENF_ASSERT(end_ <= impl().size(), "Internal failure: PacketInterpreter range outside of data container"); return boost::next(impl().begin(),end_); } prefix_ senf::PacketData::size_type senf::PacketData::size() const { return end_ - begin_; } prefix_ bool senf::PacketData::empty() const { return begin_ == end_; } prefix_ senf::PacketData::byte senf::PacketData::operator[](size_type n) const { SENF_ASSERT( n < size(), "Access out of container range" ); return *( boost::next(begin(),n) ); } prefix_ senf::PacketData::byte & senf::PacketData::operator[](size_type n) { SENF_ASSERT( n < size(), "Access out of container range" ); return *( boost::next(begin(),n) ); } // Modifying the raw packet data prefix_ void senf::PacketData::insert(iterator pos, byte v) { impl().insert(this,pos,v); } prefix_ void senf::PacketData::insert(iterator pos, size_type n, byte v) { impl().insert(this,pos,n,v); } prefix_ void senf::PacketData::erase(iterator pos) { impl().erase(this,pos); } prefix_ void senf::PacketData::erase(iterator first, iterator last) { impl().erase(this,first,last); } prefix_ void senf::PacketData::clear() { impl().clear(this); } prefix_ void senf::PacketData::reserve(size_type n) { impl().reserve(n + size() - impl().size()); } prefix_ senf::PacketData::size_type senf::PacketData::capacity() const { return impl().capacity() - (impl().size() - size()); } prefix_ bool senf::PacketData::valid() { return impl_; } // protected members prefix_ senf::PacketData::PacketData(size_type b, size_type e) : impl_(), begin_(b), end_(e) {} //-///////////////////////////////////////////////////////////////////////////////////////////////// #undef prefix_ // Local Variables: // mode: c++ // fill-column: 100 // c-file-style: "senf" // indent-tabs-mode: nil // ispell-local-dictionary: "american" // compile-command: "scons -u test" // comment-column: 40 // End: