X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Packets%2FPacket.cci;h=813ab10e4c62104c2bfe2a99eb3a015e77910e66;hb=0734bd14c709ca5ba1d0ed69c5b9f5d1487e5faa;hp=e29f0509eeb53e6c5c8ead5fd351b3165e5334ff;hpb=f73fa16ed5abdce272ac77f8b8b9ef2b9922c266;p=senf.git diff --git a/Packets/Packet.cci b/Packets/Packet.cci index e29f050..813ab10 100644 --- a/Packets/Packet.cci +++ b/Packets/Packet.cci @@ -1,8 +1,8 @@ // $Id$ // -// Copyright (C) 2007 -// Fraunhofer Institute for Open Communication Systems (FOKUS) -// Competence Center NETwork research (NET), St. Augustin, GERMANY +// 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 @@ -24,6 +24,7 @@ \brief Packet inline non-template implementation */ // Custom includes +#include "../Utils/senfassert.hh" #define prefix_ inline ///////////////////////////////cci.p/////////////////////////////////////// @@ -47,6 +48,14 @@ prefix_ senf::Packet senf::Packet::clone() prefix_ senf::Packet senf::Packet::next() const { + Packet p (next(nothrow)); + if (!p) throw InvalidPacketChainException(); + return p; +} + +prefix_ senf::Packet senf::Packet::next(NoThrow_t) + const +{ PacketInterpreterBase::ptr p (ptr()->next()); return !p && ptr()->nextPacketRange() ? checkNext() : Packet(p); } @@ -54,6 +63,14 @@ prefix_ senf::Packet senf::Packet::next() prefix_ senf::Packet senf::Packet::prev() const { + Packet p (prev(nothrow)); + if (!p) throw InvalidPacketChainException(); + return p; +} + +prefix_ senf::Packet senf::Packet::prev(NoThrow_t) + const +{ return Packet(ptr()->prev()); } @@ -67,7 +84,7 @@ prefix_ senf::Packet senf::Packet::last() const { Packet p (ptr()->last()); - return p.next() ? checkLast() : p; + return p.next(nothrow) ? checkLast() : p; } prefix_ senf::Packet senf::Packet::parseNextAs(factory_t factory) @@ -146,7 +163,7 @@ prefix_ senf::Packet::Packet(PacketInterpreterBase::ptr packet) prefix_ senf::PacketInterpreterBase::ptr senf::Packet::ptr() const { - BOOST_ASSERT(packet_); + SENF_ASSERT(packet_); return packet_; }