// protected members
-prefix_ senf::Packet::Packet(PacketInterpreterBase::ptr packet)
+prefix_ senf::Packet::Packet(PacketInterpreterBase::ptr const & packet)
: packet_(packet)
{}
-prefix_ senf::PacketInterpreterBase::ptr senf::Packet::ptr()
+prefix_ senf::PacketInterpreterBase::ptr const & senf::Packet::ptr()
const
{
SENF_ASSERT(packet_, "Invalid operation (dereferencing) on in-valid() Packet");
// conversion constructors
template <class PacketType>
-prefix_ senf::Packet::Packet(ConcretePacket<PacketType> packet)
+prefix_ senf::Packet::Packet(ConcretePacket<PacketType> const & packet)
: packet_(packet.ptr())
{}
// private members
template <class PacketType>
-prefix_ senf::ConcretePacket<PacketType>::ConcretePacket(typename interpreter::ptr packet_)
+prefix_ senf::ConcretePacket<PacketType>::ConcretePacket(typename interpreter::ptr const & packet_)
: Packet(packet_)
{}
// conversion constructors
template <class PacketType>
- Packet(ConcretePacket<PacketType> packet); ///< Copy-construct Packet from ConcretePacket
+ Packet(ConcretePacket<PacketType> const & packet);
+ ///< Copy-construct Packet from ConcretePacket
/**< This constructor allows to convert an arbitrary
ConcretePacket into a general Packet, loosing the
protocol specific interface. */
///@}
protected:
- explicit Packet(PacketInterpreterBase::ptr packet);
+ explicit Packet(PacketInterpreterBase::ptr const & packet);
- PacketInterpreterBase::ptr ptr() const;
+ PacketInterpreterBase::ptr const & ptr() const;
private:
Packet checkNext() const;
private:
typedef PacketInterpreter<PacketType> interpreter;
- ConcretePacket(typename interpreter::ptr packet_);
+ ConcretePacket(typename interpreter::ptr const & packet_);
typename interpreter::ptr ptr() const;
senf::safe_data_iterator safe_i_;
mutable PacketParserBase const * parser_;
- ParserProtector( PacketParserBase const * parser);
+ ParserProtector(PacketParserBase const * parser);
ParserProtector(ParserProtector const & other_);
~ParserProtector();
};
template <class Self>
prefix_ senf::PacketInterpreterBase::optional_range
-senf::PacketTypeMixin<Self,void>::nextPacketRange(Packet const & p)
+senf::PacketTypeMixin<Self,void>::nextPacketRange(ConcretePacket<Self> const & p)
{
typename Self::size_type sz (Self::initHeadSize());
///\idea This if condition could be replaced with a compile time switch by checking, wether
/// (the function address) Self::initHeadSize is different from PacketTypeBase::initHeadSize
if (sz == PacketTypeBase::size_type(-1)) {
- typename Self::size_type headsz (bytes(p.as< ConcretePacket<Self> >().parser()));
+ typename Self::size_type headsz (bytes(p.parser()));
return p.data().size() < headsz ?
PacketTypeBase::no_range() :
PacketInterpreterBase::optional_range(
template <class Self, class Registry>
prefix_ senf::PacketInterpreterBase::optional_range
-senf::PacketTypeMixin<Self,Registry>::nextPacketRange(Packet const & p)
+senf::PacketTypeMixin<Self,Registry>::nextPacketRange(ConcretePacket<Self> const & p)
{
// Call the member defined in the specialization below
return PacketTypeMixin<Self>::nextPacketRange(p);
template <class Self, class Registry>
prefix_ senf::PacketInterpreterBase::factory_t
-senf::PacketTypeMixin<Self,Registry>::nextPacketType(Packet const & p)
+senf::PacketTypeMixin<Self,Registry>::nextPacketType(ConcretePacket<Self> const & p)
{
if (p.data().size() < Self::initSize())
return Self::no_factory();
- return lookup( Self::nextPacketKey(p.as< ConcretePacket<Self> >()) );
+ return lookup( Self::nextPacketKey(p) );
}
template <class Self, class Registry>
}
template <class Self, class Registry>
-prefix_ void senf::PacketTypeMixin<Self,Registry>::init(Packet const & p)
+prefix_ void senf::PacketTypeMixin<Self,Registry>::init(ConcretePacket<Self> const & p)
{
- p.as< ConcretePacket<Self> >()->init();
+ p->init();
}
template <class Self, class Registry>
}
template <class Self>
-prefix_ void senf::PacketTypeMixin<Self,void>::init(Packet const & p)
+prefix_ void senf::PacketTypeMixin<Self,void>::init(ConcretePacket<Self> const & p)
{
- p.as< ConcretePacket<Self> >()->init();
+ p->init();
}
///////////////////////////////cti.e///////////////////////////////////////
///\name PacketType interface implementation
///@{
- static PacketInterpreterBase::optional_range nextPacketRange (Packet const & p);
- static PacketInterpreterBase::factory_t nextPacketType (Packet const & p);
+ static PacketInterpreterBase::optional_range nextPacketRange (ConcretePacket<Self> const & p);
+ static PacketInterpreterBase::factory_t nextPacketType (ConcretePacket<Self> const & p);
static PacketInterpreterBase::size_type initSize ();
- static void init (Packet const & p);
+ static void init (ConcretePacket<Self> const & p);
///@}
};
class PacketTypeMixin<Self,void>
{
public:
- static PacketInterpreterBase::optional_range nextPacketRange (Packet const & p);
+ static PacketInterpreterBase::optional_range nextPacketRange (ConcretePacket<Self> const & p);
static PacketInterpreterBase::size_type initSize ();
- static void init (Packet const & p);
+ static void init (ConcretePacket<Self> const & p);
};
# endif