// $Id$ // // Copyright (C) 2007 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the // Free Software Foundation, Inc., // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /** \file \brief Packet inline non-template implementation */ // Custom includes #include "../Utils/senfassert.hh" #define prefix_ inline ///////////////////////////////cci.p/////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// // senf::Packet // protected members prefix_ senf::Packet::Packet(PacketInterpreterBase::ptr packet) : packet_(packet) {} prefix_ senf::PacketInterpreterBase::ptr senf::Packet::ptr() const { SENF_ASSERT(packet_); return packet_; } // public structors prefix_ senf::Packet::Packet() {} // public members prefix_ senf::Packet senf::Packet::clone() const { return Packet(ptr()->clone()); } // Interpreter chain access prefix_ senf::Packet senf::Packet::next(NoThrow_t) const { PacketInterpreterBase::ptr p (ptr()->next()); return !p && ptr()->nextPacketRange() ? checkNext() : Packet(p); } prefix_ senf::Packet senf::Packet::next() const { Packet p (next(nothrow)); if (!p) throw InvalidPacketChainException(); return p; } prefix_ senf::Packet senf::Packet::prev(NoThrow_t) const { return Packet(ptr()->prev()); } prefix_ senf::Packet senf::Packet::prev() const { Packet p (prev(nothrow)); if (!p) throw InvalidPacketChainException(); return p; } prefix_ senf::Packet senf::Packet::first() const { return Packet(ptr()->first()); } prefix_ senf::Packet senf::Packet::last() const { Packet p (ptr()->last()); return p.next(nothrow) ? checkLast() : p; } prefix_ senf::Packet senf::Packet::parseNextAs(factory_t factory) const { return Packet(ptr()->parseNextAs(factory)); } prefix_ senf::Packet senf::Packet::append(Packet packet) const { return Packet(ptr()->append(packet.ptr())); } // Data access prefix_ senf::PacketData & senf::Packet::data() const { return ptr()->data(); } prefix_ senf::Packet::size_type senf::Packet::size() const { return data().size(); } // Other methods prefix_ bool senf::Packet::operator==(Packet other) const { return ptr() == other.ptr(); } prefix_ void senf::Packet::finalizeThis() { ptr()->finalizeThis(); } prefix_ void senf::Packet::finalizeTo(Packet other) { ptr()->finalizeTo(other.ptr()); } prefix_ void senf::Packet::finalizeAll() { ptr()->finalizeTo(last().ptr()); } prefix_ void senf::Packet::dump(std::ostream & os) const { last(); // Make sure the packet is complete ptr()->dump(os); } prefix_ senf::TypeIdValue senf::Packet::typeId() const { return ptr()->typeId(); } prefix_ senf::Packet::factory_t senf::Packet::factory() const { return ptr()->factory(); } prefix_ bool senf::Packet::boolean_test() const { return packet_ && packet_->valid(); } ///////////////////////////////cci.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: