X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=PPI%2FConnectors.hh;h=60b1f719d8ba476b4a5ada017886a8970153cc38;hb=8aa27cfde664f462f1aebd601f1521c186d819c3;hp=68a0ea4cc909f2883f2c27a20b0b70480fc568fc;hpb=6d612eda73e43f9304bd178aff02020a6e7be3fe;p=senf.git diff --git a/PPI/Connectors.hh b/PPI/Connectors.hh index 68a0ea4..60b1f71 100644 --- a/PPI/Connectors.hh +++ b/PPI/Connectors.hh @@ -31,6 +31,7 @@ #include #include #include "../Utils/safe_bool.hh" +#include "../Utils/Exception.hh" #include "../Packets/Packets.hh" #include "predecl.hh" #include "detail/Callback.hh" @@ -99,6 +100,9 @@ namespace connector { \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 @@ -119,6 +123,8 @@ namespace connector { void connect(Connector & target); private: + virtual std::type_info const & packetTypeID(); + void setModule(module::Module & module); Connector * peer_; @@ -450,21 +456,23 @@ namespace connector { # define TypedConnector_Input read # define TypedConnector_Output write -# define TypedConnector(type, dir) \ +# define TypedConnector(pType, dir) \ template \ - class type ## dir \ - : public Generic ## type ## dir, \ - private detail::Typed ## dir ## Mixin, PacketType> \ + class pType ## dir \ + : public Generic ## pType ## dir, \ + private detail::Typed ## dir ## Mixin, PacketType> \ { \ - typedef detail::Typed ## dir ## Mixin, PacketType> mixin; \ + typedef detail::Typed ## dir ## Mixin, PacketType> mixin; \ public: \ using mixin::operator(); \ using mixin::TypedConnector_ ## dir ; \ private: \ - friend class detail::Typed ## dir ## Mixin, PacketType>; \ + virtual std::type_info const & packetTypeID() \ + { return typeid(typename PacketType::type); } \ + friend class detail::Typed ## dir ## Mixin, PacketType>; \ }; \ template <> \ - class type ## dir : public Generic ## type ## dir \ + class pType ## dir : public Generic ## pType ## dir \ {} TypedConnector( Passive, Input ); @@ -479,6 +487,8 @@ namespace connector { #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 @@ -500,6 +510,8 @@ namespace connector { /** \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 @@ -521,6 +533,8 @@ namespace connector { /** \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. @@ -538,6 +552,8 @@ namespace connector { /** \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.