diff --git a/amqpcpp.h b/amqpcpp.h index 008a2c1..23f097c 100644 --- a/amqpcpp.h +++ b/amqpcpp.h @@ -73,3 +73,4 @@ #include #include #include +#include diff --git a/include/channel.h b/include/channel.h index 1597f23..13a600b 100644 --- a/include/channel.h +++ b/include/channel.h @@ -14,11 +14,6 @@ */ namespace AMQP { -/** - * Forward declarations - */ -class TcpConnection; - /** * Class definition */ @@ -42,16 +37,6 @@ public: _implementation->attach(connection); } - /** - * Construct a channel around a wrapped-connection - * @param connection - */ - Channel(TcpConnection *connection) : _implementation(new ChannelImpl()) - { - // attach the connection to the channel - _implementation->attach(connection); - } - /** * Copy'ing of channel objects is not supported * @param channel diff --git a/include/channelimpl.h b/include/channelimpl.h index e7444a0..6261827 100644 --- a/include/channelimpl.h +++ b/include/channelimpl.h @@ -18,7 +18,6 @@ namespace AMQP { * Forward declarations */ class ConsumedMessage; -class TcpConnection; /** * Class definition @@ -110,12 +109,6 @@ private: */ void attach(Connection *connection); - /** - * Attach the connection - * @param connection - */ - void attach(TcpConnection *connection); - /** * Push a deferred result * @param result The deferred result diff --git a/include/tcpchannel.h b/include/tcpchannel.h new file mode 100644 index 0000000..3d19053 --- /dev/null +++ b/include/tcpchannel.h @@ -0,0 +1,43 @@ +/** + * TcpChannel.h + * + * Extended channel that can be constructed on top of a TCP connection + * + * @author Emiel Bruijntjes + * @copyright 2015 Copernica BV + */ + +/** + * Include guard + */ +#pragma once + +/** + * Set up namespace + */ +namespace AMQP { + +/** + * Class definition + */ +class TcpChannel : public Channel +{ +public: + /** + * Constructor + * @param connection + */ + TcpChannel(TcpConnection *connection) : + Channel(&connection->_connection) {} + + /** + * Destructor + */ + virtual ~TcpChannel() {} +}; + +/** + * End of namespace + */ +} + diff --git a/include/tcpconnection.h b/include/tcpconnection.h index 3422407..b3c18ba 100644 --- a/include/tcpconnection.h +++ b/include/tcpconnection.h @@ -84,7 +84,7 @@ private: * Classes that have access to private data */ friend class TcpConnected; - friend class ChannelImpl; + friend class TcpChannel; public: diff --git a/src/channelimpl.cpp b/src/channelimpl.cpp index 1fdbd4d..e285385 100644 --- a/src/channelimpl.cpp +++ b/src/channelimpl.cpp @@ -90,16 +90,6 @@ void ChannelImpl::attach(Connection *connection) } } -/** - * Initialize the object with an connection - * @param connection - */ -void ChannelImpl::attach(TcpConnection *connection) -{ - // pass to the other attach() method - attach(&connection->_connection); -} - /** * Push a deferred result * @param result The deferred object to push