2015-11-01 16:51:43 +08:00
|
|
|
/**
|
|
|
|
|
* TcpChannel.h
|
|
|
|
|
*
|
|
|
|
|
* Extended channel that can be constructed on top of a TCP connection
|
|
|
|
|
*
|
|
|
|
|
* @author Emiel Bruijntjes <emiel.bruijntjes@copernica.com>
|
2017-11-17 18:38:54 +08:00
|
|
|
* @copyright 2015 - 2017 Copernica BV
|
2015-11-01 16:51:43 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Include guard
|
|
|
|
|
*/
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set up namespace
|
|
|
|
|
*/
|
|
|
|
|
namespace AMQP {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Class definition
|
|
|
|
|
*/
|
|
|
|
|
class TcpChannel : public Channel
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
/**
|
|
|
|
|
* Constructor
|
2017-11-17 18:38:54 +08:00
|
|
|
*
|
|
|
|
|
* The passed in connection pointer must remain valid for the
|
2018-11-23 18:15:51 +08:00
|
|
|
* lifetime of the channel. A constructor is thrown if the channel
|
|
|
|
|
* cannot be connected (because the connection is already closed or
|
|
|
|
|
* because max number of channels has been reached)
|
2017-11-17 18:38:54 +08:00
|
|
|
*
|
2015-11-01 16:51:43 +08:00
|
|
|
* @param connection
|
2018-11-23 18:15:51 +08:00
|
|
|
* @throws std::runtime_error
|
2015-11-01 16:51:43 +08:00
|
|
|
*/
|
|
|
|
|
TcpChannel(TcpConnection *connection) :
|
|
|
|
|
Channel(&connection->_connection) {}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Destructor
|
|
|
|
|
*/
|
|
|
|
|
virtual ~TcpChannel() {}
|
2018-08-31 21:01:10 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Copying is not allowed.
|
|
|
|
|
* @param other
|
|
|
|
|
*/
|
|
|
|
|
TcpChannel(const TcpChannel &other) = delete;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* But movement is allowed
|
|
|
|
|
* @param other
|
|
|
|
|
*/
|
|
|
|
|
TcpChannel(TcpChannel &&other) = default;
|
2015-11-01 16:51:43 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* End of namespace
|
|
|
|
|
*/
|
|
|
|
|
}
|
|
|
|
|
|