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 Packet inline non-template implementation */
27 #include "../Utils/senfassert.hh"
29 #define prefix_ inline
30 ///////////////////////////////cci.p///////////////////////////////////////
32 ///////////////////////////////////////////////////////////////////////////
37 prefix_ senf::Packet::Packet()
40 prefix_ senf::Packet senf::Packet::clone()
43 return Packet(ptr()->clone());
46 // Interpreter chain access
48 prefix_ senf::Packet senf::Packet::next()
51 Packet p (next(nothrow));
52 if (!p) throw InvalidPacketChainException();
56 prefix_ senf::Packet senf::Packet::next(NoThrow_t)
59 PacketInterpreterBase::ptr p (ptr()->next());
60 return !p && ptr()->nextPacketRange() ? checkNext() : Packet(p);
63 prefix_ senf::Packet senf::Packet::prev()
66 Packet p (prev(nothrow));
67 if (!p) throw InvalidPacketChainException();
71 prefix_ senf::Packet senf::Packet::prev(NoThrow_t)
74 return Packet(ptr()->prev());
77 prefix_ senf::Packet senf::Packet::first()
80 return Packet(ptr()->first());
83 prefix_ senf::Packet senf::Packet::last()
86 Packet p (ptr()->last());
87 return p.next(nothrow) ? checkLast() : p;
90 prefix_ senf::Packet senf::Packet::parseNextAs(factory_t factory)
93 return Packet(ptr()->parseNextAs(factory));
96 prefix_ senf::Packet senf::Packet::append(Packet packet)
99 return Packet(ptr()->append(packet.ptr()));
104 prefix_ senf::PacketData & senf::Packet::data()
107 return ptr()->data();
110 prefix_ senf::Packet::size_type senf::Packet::size()
113 return data().size();
119 prefix_ bool senf::Packet::operator==(Packet other)
122 return ptr() == other.ptr();
125 prefix_ void senf::Packet::finalize()
128 last(); // Make sure the packet is complete
132 prefix_ void senf::Packet::dump(std::ostream & os)
135 last(); // Make sure the packet is complete
139 prefix_ senf::TypeIdValue senf::Packet::typeId()
142 return ptr()->typeId();
145 prefix_ senf::Packet::factory_t senf::Packet::factory()
148 return ptr()->factory();
151 prefix_ bool senf::Packet::boolean_test()
154 return packet_ && packet_->valid();
159 prefix_ senf::Packet::Packet(PacketInterpreterBase::ptr packet)
163 prefix_ senf::PacketInterpreterBase::ptr senf::Packet::ptr()
166 SENF_ASSERT(packet_);
170 ///////////////////////////////cci.e///////////////////////////////////////
177 // c-file-style: "senf"
178 // indent-tabs-mode: nil
179 // ispell-local-dictionary: "american"
180 // compile-command: "scons -u test"
181 // comment-column: 40