StormByte C++ Library: Network module 0.0.9999
StormByte-Network is a StormByte library module for handling and create network connections
Loading...
Searching...
No Matches
endpoint.hxx
1#pragma once
2
3#include <StormByte/network/typedefs.hxx>
4#include <StormByte/logger.hxx>
5
6#include <atomic>
7
12namespace StormByte::Network {
17 class STORMBYTE_NETWORK_PUBLIC EndPoint {
18 public:
25 EndPoint(const Connection::Protocol& protocol, std::shared_ptr<Connection::Handler> handler, std::shared_ptr<Logger> logger) noexcept;
26
30 EndPoint(const EndPoint& other) = delete;
31
35 EndPoint(EndPoint&& other) noexcept = default;
36
40 virtual ~EndPoint() noexcept;
41
45 EndPoint& operator=(const EndPoint& other) = delete;
46
50 EndPoint& operator=(EndPoint&& other) noexcept = default;
51
56 const Connection::Protocol& Protocol() const noexcept;
57
58 protected:
59 Connection::Protocol m_protocol;
60 std::shared_ptr<Connection::Handler> m_handler;
61 std::shared_ptr<Logger> m_logger;
62 std::atomic<Connection::Status> m_status;
63 Socket::Socket* m_socket;
64 };
65}
Represents a network endpoint, serving as a base class for both clients and servers.
Definition endpoint.hxx:17
virtual ~EndPoint() noexcept
Virtual destructor for proper cleanup in derived classes.
EndPoint(const Connection::Protocol &protocol, std::shared_ptr< Connection::Handler > handler, std::shared_ptr< Logger > logger) noexcept
Constructs an EndPoint with the specified protocol, handler, and logger.
EndPoint(const EndPoint &other)=delete
Deleted copy constructor to prevent copying.
EndPoint(EndPoint &&other) noexcept=default
Defaulted move constructor.
The namespace containing connection items.
Contains all the network-related classes and utilities.
Definition client.hxx:10