diff options
author | Claudius 'keldu' Holeksa <mail@keldu.de> | 2024-10-16 15:59:39 +0200 |
---|---|---|
committer | Claudius 'keldu' Holeksa <mail@keldu.de> | 2024-10-16 15:59:39 +0200 |
commit | b10d0b0e1a30eb02777f5a02b81bf45e09749edb (patch) | |
tree | 2de7e372677037e6c8880c1f52ba32d55d1a85a8 /modules/io/c++ | |
parent | 09e164c02120f05c9364d5d9a8faad2ec0026425 (diff) |
Fixing bad includes and changing network abstraction a tiny bit
Diffstat (limited to 'modules/io/c++')
-rw-r--r-- | modules/io/c++/io.hpp | 7 | ||||
-rw-r--r-- | modules/io/c++/io_unix.cpp | 8 |
2 files changed, 10 insertions, 5 deletions
diff --git a/modules/io/c++/io.hpp b/modules/io/c++/io.hpp index 43ef7f0..390ddcc 100644 --- a/modules/io/c++/io.hpp +++ b/modules/io/c++/io.hpp @@ -8,6 +8,10 @@ #include <variant> namespace saw { +namespace net { +struct Os {}; +} + /** * Set of error common in io */ @@ -166,6 +170,7 @@ public: network_address::child_variant representation() override { return this; } }; +template<typename T = net::Os> class network { public: virtual ~network() = default; @@ -209,7 +214,7 @@ public: virtual own<input_stream> wrap_input_fd(int fd) = 0; - virtual network &get_network() = 0; + virtual network<net::Os> &get_network() = 0; }; struct async_io_context { diff --git a/modules/io/c++/io_unix.cpp b/modules/io/c++/io_unix.cpp index a715535..73e8e3b 100644 --- a/modules/io/c++/io_unix.cpp +++ b/modules/io/c++/io_unix.cpp @@ -430,7 +430,7 @@ public: size_t unix_address_size() const; }; -class unix_network final : public network { +class unix_network final : public network<net::Os> { private: unix_event_port &event_port_; @@ -462,7 +462,7 @@ private: public: unix_io_provider(unix_event_port &port_ref, own<event_port> port); - class network &get_network() override; + class network<net::Os> &get_network() override; own<input_stream> wrap_input_fd(int fd) override; @@ -895,8 +895,8 @@ own<input_stream> unix_io_provider::wrap_input_fd(int fd) { return heap<unix_io_stream>(event_port_, fd, 0, EPOLLIN); } -class network &unix_io_provider::get_network() { - return static_cast<class network &>(unix_network_); +class network<net::Os> &unix_io_provider::get_network() { + return static_cast<class network<net::Os> &>(unix_network_); } class event_loop &unix_io_provider::event_loop() { |