#include <boost/utility.hpp>
#include <boost/scoped_ptr.hpp>
#include "../Utils/safe_bool.hh"
+#include "../Utils/Exception.hh"
#include "../Packets/Packets.hh"
#include "predecl.hh"
#include "detail/Callback.hh"
\ref ppi_connectors
*/
+ struct IncompatibleConnectorsException : public senf::Exception
+ { IncompatibleConnectorsException() : senf::Exception("Incompatible connectors") {} };
+
/** \brief Connector base-class
This connector provides access to the generic connector facilities. This includes the
void connect(Connector & target);
private:
+ virtual std::type_info const & packetTypeID();
+
void setModule(module::Module & module);
Connector * peer_;
# define TypedConnector_Input read
# define TypedConnector_Output write
-# define TypedConnector(type, dir) \
+# define TypedConnector(pType, dir) \
template <class PacketType> \
- class type ## dir \
- : public Generic ## type ## dir, \
- private detail::Typed ## dir ## Mixin<type ## dir <PacketType>, PacketType> \
+ class pType ## dir \
+ : public Generic ## pType ## dir, \
+ private detail::Typed ## dir ## Mixin<pType ## dir <PacketType>, PacketType> \
{ \
- typedef detail::Typed ## dir ## Mixin<type ## dir <PacketType>, PacketType> mixin; \
+ typedef detail::Typed ## dir ## Mixin<pType ## dir <PacketType>, PacketType> mixin; \
public: \
using mixin::operator(); \
using mixin::TypedConnector_ ## dir ; \
private: \
- friend class detail::Typed ## dir ## Mixin<type ## dir <PacketType>, PacketType>; \
+ virtual std::type_info const & packetTypeID() \
+ { return typeid(typename PacketType::type); } \
+ friend class detail::Typed ## dir ## Mixin<pType ## dir <PacketType>, PacketType>; \
}; \
template <> \
- class type ## dir <Packet> : public Generic ## type ## dir \
+ class pType ## dir <Packet> : public Generic ## pType ## dir \
{}
TypedConnector( Passive, Input );
#else
/** \brief Connector actively reading packets
+
+ \tparam PacketType Type of packet to read. Defaults to senf::Packet
The ActiveInput connector template reads data actively from a connected module. This class
is completely implemented via it's base-class, GenericActiveInput, the only difference is
/** \brief Connector passively receiving packets
+ \tparam PacketType Type of packet to read. Defaults to senf::Packet
+
The PassiveInput connector template receives packets sent to it from a connected
module. This class is completely implemented via it's base-class, GenericPassiveInput, the
only difference is that read packets are returned as \a PacketType instead of generic
/** \brief Connector actively sending packets
+ \tparam PacketType Type of packet to send. Defaults to senf::Packet
+
The ActiveOutput connector template sends data actively to a connected module. This class is
completely implemented via it's base-class, GenericActiveOutput, the only difference is that
it only sends packets of type \a PacketType.
/** \brief Connector passively providing packets
+ \tparam PacketType Type of packet to send. Defaults to senf::Packet
+
The PassiveOutput connector template provides data passively to a connected module whenever
signaled. This class is completely implemented via it's base-class, GenericPassiveOutput, the
only difference is that it only sends packets of type \a PacketType.