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 PacketInterpreter non-inline non-template implementation */
26 //#include "PacketInterpreter.ih"
31 //#include "PacketInterpreter.mpp"
33 ///////////////////////////////cc.p////////////////////////////////////////
35 ///////////////////////////////////////////////////////////////////////////
36 // senf::PacketInterpreterBase
38 // structors and default members
40 prefix_ senf::PacketInterpreterBase::~PacketInterpreterBase()
43 prefix_ senf::PacketInterpreterBase::ptr senf::PacketInterpreterBase::clone()
45 detail::PacketImpl::Guard p (new detail::PacketImpl(begin(),end()));
46 ptr pi (appendClone(p.p,begin(),p.p->begin()));
47 for (ptr i (next()); i; i = i->next())
48 i->appendClone(p.p,begin(),p.p->begin());
52 // Interpreter chain access
54 prefix_ senf::PacketInterpreterBase::ptr senf::PacketInterpreterBase::append(ptr packet)
57 impl().truncateInterpreters(next().get());
59 optional_range r (nextPacketRange());
61 throw InvalidPacketChainException();
63 ptr rv (packet->appendClone(&impl(), *r));
64 rv->data().resize(packet->data().size());
65 std::copy(packet->data().begin(), packet->data().end(), rv->data().begin());
67 for (ptr p (packet->next()) ; p ; p = p->next())
68 p->appendClone(&impl(), packet->data().begin(), rv->data().begin());
73 // Access to the abstract interface
75 prefix_ void senf::PacketInterpreterBase::dump(std::ostream & os)
78 for (ptr i (next()); i; i = i->next())
82 prefix_ void senf::PacketInterpreterBase::finalizeThis()
87 prefix_ void senf::PacketInterpreterBase::finalizeTo(ptr other)
89 for (ptr i (other); i.get() != this && i.get(); i = i->prev())
94 ///////////////////////////////////////////////////////////////////////////
95 // senf::PacketInterpreterBase::Factory
97 prefix_ senf::PacketInterpreterBase::Factory::~Factory()
100 ///////////////////////////////cc.e////////////////////////////////////////
102 //#include "PacketInterpreter.mpp"
108 // c-file-style: "senf"
109 // indent-tabs-mode: nil
110 // ispell-local-dictionary: "american"
111 // compile-command: "scons -u test"
112 // comment-column: 40