4 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
5 // Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
6 // Stefan Bund <stefan.bund@fokus.fraunhofer.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.
23 #if !BOOST_PP_IS_ITERATING
26 #include <boost/preprocessor/iteration/iterate.hpp>
27 #include <boost/preprocessor/enum.hpp>
28 #include <boost/preprocessor/cat.hpp>
32 # define pkARG(z,n,data) BOOST_PP_CAT(A,n) const & BOOST_PP_CAT(a,n)
38 //////////////////////////////mpp.p////////////////////////////////////////
40 #if BOOST_PP_ITERATION_DEPTH()==1 && BOOST_PP_ITERATION_FLAGS()==1
41 ///////////////////////////////////////////////////////////////////////////
42 // Packet::reinterpret member template declaration
44 template < class OtherPacket, BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), class A) >
45 typename ptr_t<OtherPacket>::ptr reinterpret( BOOST_PP_ENUM( BOOST_PP_ITERATION(), pkARG, ) );
47 #elif BOOST_PP_ITERATION_DEPTH()==1 && BOOST_PP_ITERATION_FLAGS()==2
48 ///////////////////////////////////////////////////////////////////////////
49 // Packet::reinterpret implementation
51 template <class OtherPacket, BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), class A) >
52 prefix_ typename satcom::pkf::Packet::ptr_t<OtherPacket>::ptr
53 satcom::pkf::Packet::reinterpret( BOOST_PP_ENUM( BOOST_PP_ITERATION(), pkARG, ) )
55 if (!OtherPacket::check(begin(),end()))
56 throw TruncatedPacketException();
57 typename ptr_t<OtherPacket>::ptr p (
58 new OtherPacket(PacketOp_replace(this),
59 BOOST_PP_ENUM_PARAMS( BOOST_PP_ITERATION(), a ) ),
64 #elif BOOST_PP_ITERATION_DEPTH()==1 && BOOST_PP_ITERATION_FLAGS()==3
65 ///////////////////////////////////////////////////////////////////////////
66 // Packet::registerInterpreter member template declaration
68 template < class OtherPacket, BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), class A) >
69 typename ptr_t<OtherPacket>::ptr registerInterpreter(
70 raw_container::iterator begin, raw_container::iterator end,
71 BOOST_PP_ENUM( BOOST_PP_ITERATION(), pkARG, ) ) const;
73 #elif BOOST_PP_ITERATION_DEPTH()==1 && BOOST_PP_ITERATION_FLAGS()==4
74 ///////////////////////////////////////////////////////////////////////////
75 // Packet::registerIterpreter implementation
77 template <class OtherPacket, BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), class A) >
78 prefix_ typename satcom::pkf::Packet::ptr_t<OtherPacket>::ptr
79 satcom::pkf::Packet::registerInterpreter(raw_container::iterator begin,
80 raw_container::iterator end,
81 BOOST_PP_ENUM( BOOST_PP_ITERATION(), pkARG, ) )
84 if (!OtherPacket::check(begin,end))
85 throw TruncatedPacketException();
86 typename ptr_t<OtherPacket>::ptr p (
87 new OtherPacket(PacketOp_register(begin-impl_->data_.begin(),
88 end-impl_->data_.begin(),
90 BOOST_PP_ENUM_PARAMS( BOOST_PP_ITERATION(), a) ),
95 #elif BOOST_PP_ITERATION_DEPTH()==1 && BOOST_PP_ITERATION_FLAGS()==5
96 ///////////////////////////////////////////////////////////////////////////
97 // Packet::create declaration
99 template < class OtherPacket, class InputIterator,
100 BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), class A) >
101 static typename satcom::pkf::Packet::ptr_t<OtherPacket>::ptr create(
102 InputIterator b, InputIterator e,
103 BOOST_PP_ENUM( BOOST_PP_ITERATION(), pkARG, ) );
105 #elif BOOST_PP_ITERATION_DEPTH()==1 && BOOST_PP_ITERATION_FLAGS()==6
106 ///////////////////////////////////////////////////////////////////////////
107 // Packet::create implementation
109 template < class OtherPacket, class InputIterator,
110 BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), class A) >
111 typename satcom::pkf::Packet::ptr_t<OtherPacket>::ptr satcom::pkf::Packet::create(
112 InputIterator b, InputIterator e,
113 BOOST_PP_ENUM( BOOST_PP_ITERATION(), pkARG, ) )
115 boost::intrusive_ptr<impl::PacketImpl> impl (new impl::PacketImpl(b,e),false);
116 if (!OtherPacket::check(impl->data_.begin(), impl->data_.end()))
117 throw TruncatedPacketException();
118 typename ptr_t<OtherPacket>::ptr p (
119 new OtherPacket(PacketOp_set(impl.get()),
120 BOOST_PP_ENUM_PARAMS( BOOST_PP_ITERATION(), a) ),
127 //////////////////////////////mpp.e////////////////////////////////////////
133 // c-file-style: "satcom"