25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

48 lines
1.1 KiB

  1. #pragma once
  2. #include <memory>
  3. #include <cppamqp/enums.h>
  4. #include <cppamqp/types.h>
  5. #include <cppamqp/config.h>
  6. #include <cppamqp/channel.h>
  7. #include <cppamqp/exception.inl>
  8. #include <cppamqp/connection.fwd.h>
  9. namespace cppamqp
  10. {
  11. channel::channel(const cppamqp::connection& p_connection, channel_number p_handle)
  12. : _internal(new internal(p_connection, p_handle))
  13. { }
  14. channel::channel()
  15. { }
  16. channel::channel(channel&& other)
  17. : _internal(std::move(other._internal))
  18. { }
  19. channel::~channel()
  20. { }
  21. channel::operator bool() const
  22. { return static_cast<bool>(_internal); }
  23. void channel::operator =(channel&& other)
  24. { _internal = std::move(other._internal); }
  25. channel_number channel::handle() const
  26. {
  27. if (!_internal)
  28. throw exception("channel is closed!");
  29. return _internal->handle;
  30. }
  31. const connection& channel::connection() const
  32. {
  33. if (!_internal)
  34. throw exception("channel is closed!");
  35. return _internal->connection;
  36. }
  37. }