2 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
3 // Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
4 // Stefan Bund <g0dil@berlios.de>
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the
18 // Free Software Foundation, Inc.,
19 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 \brief PacketInterpreter non-inline non-template implementation */
24 //#include "PacketInterpreter.ih"
29 //#include "PacketInterpreter.mpp"
31 ///////////////////////////////cc.p////////////////////////////////////////
33 ///////////////////////////////////////////////////////////////////////////
34 // senf::PacketInterpreterBase
36 // structors and default members
38 prefix_ senf::PacketInterpreterBase::~PacketInterpreterBase()
41 prefix_ senf::PacketInterpreterBase::ptr senf::PacketInterpreterBase::clone()
43 detail::PacketImpl::Guard p (new detail::PacketImpl(begin(),end()));
44 ptr pi (appendClone(p.p,begin(),p.p->begin()));
45 for (ptr i (next()); i; i = i->next())
46 i->appendClone(p.p,begin(),p.p->begin());
50 // Interpreter chain access
52 prefix_ senf::PacketInterpreterBase::ptr senf::PacketInterpreterBase::append(ptr packet)
55 impl().truncateInterpreters(next().get());
57 optional_range r (nextPacketRange());
59 throw InvalidPacketChainException();
61 ptr rv (packet->appendClone(&impl(), *r));
62 rv->data().resize(packet->data().size());
63 std::copy(packet->data().begin(), packet->data().end(), rv->data().begin());
65 for (ptr p (packet->next()) ; p ; p = p->next())
66 p->appendClone(&impl(), packet->data().begin(), rv->data().begin());
71 // Access to the abstract interface
73 prefix_ void senf::PacketInterpreterBase::dump(std::ostream & os)
76 for (ptr i (next()); i; i = i->next())
80 prefix_ void senf::PacketInterpreterBase::finalize()
82 for (ptr i (last()) ; i.get() != this ; i = i->prev())
87 ///////////////////////////////////////////////////////////////////////////
88 // senf::PacketInterpreterBase::Factory
90 prefix_ senf::PacketInterpreterBase::Factory::~Factory()
93 ///////////////////////////////cc.e////////////////////////////////////////
95 //#include "PacketInterpreter.mpp"
101 // c-file-style: "senf"
102 // indent-tabs-mode: nil
103 // ispell-local-dictionary: "american"
104 // compile-command: "scons -u test"
105 // comment-column: 40