X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=PPI%2FConnectors.hh;h=60b1f719d8ba476b4a5ada017886a8970153cc38;hb=8aa27cfde664f462f1aebd601f1521c186d819c3;hp=a69c3d8f7bda027377a5349053be9d63ee8231e8;hpb=65909c44022ccd7b97d4c2810fbf67ffa980207e;p=senf.git diff --git a/PPI/Connectors.hh b/PPI/Connectors.hh index a69c3d8..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 );