Network System 0.1.1
High-performance modular networking library for scalable client-server applications
Loading...
Searching...
No Matches
network_context.h
Go to the documentation of this file.
1// BSD 3-Clause License
2// Copyright (c) 2024-2025, 🍀☀🌕🌥 🌊
3// See the LICENSE file in the project root for full license information.
4
13#pragma once
14#ifndef KCENON_NETWORK_INTERNAL_CORE_NETWORK_CONTEXT_H_
15#define KCENON_NETWORK_INTERNAL_CORE_NETWORK_CONTEXT_H_
16
17#include <memory>
21
22namespace kcenon::network::core {
23
31class network_context {
32public:
37 static network_context& instance();
38
43 void set_thread_pool(std::shared_ptr<kcenon::network::integration::thread_pool_interface> pool);
44
49 std::shared_ptr<kcenon::network::integration::thread_pool_interface> get_thread_pool();
50
55 void set_logger(std::shared_ptr<kcenon::network::integration::logger_interface> logger);
56
61 std::shared_ptr<kcenon::network::integration::logger_interface> get_logger();
62
71 void set_monitoring(std::shared_ptr<kcenon::network::integration::monitoring_interface> monitoring);
72
81 std::shared_ptr<kcenon::network::integration::monitoring_interface> get_monitoring();
82
87 void initialize(size_t thread_count = 0);
88
92 void shutdown();
93
98 bool is_initialized() const;
99
100private:
103
104 // Non-copyable, non-movable
109
110 class impl;
111
129 std::shared_ptr<impl> pimpl_;
130};
131
132} // namespace kcenon::network::core
133
134#endif // KCENON_NETWORK_INTERNAL_CORE_NETWORK_CONTEXT_H_
Global context for shared network system resources.
Definition core.cppm:252
network_context(network_context &&)=delete
std::shared_ptr< kcenon::network::integration::monitoring_interface > get_monitoring()
Get current monitoring system.
void set_monitoring(std::shared_ptr< kcenon::network::integration::monitoring_interface > monitoring)
Set custom monitoring system.
std::shared_ptr< impl > pimpl_
PIMPL pointer with intentional leak pattern.
std::shared_ptr< kcenon::network::integration::logger_interface > get_logger()
Get current logger.
network_context & operator=(const network_context &)=delete
void set_logger(std::shared_ptr< kcenon::network::integration::logger_interface > logger)
Set custom logger.
void set_thread_pool(std::shared_ptr< kcenon::network::integration::thread_pool_interface > pool)
Set custom thread pool.
std::shared_ptr< kcenon::network::integration::thread_pool_interface > get_thread_pool()
Get current thread pool.
network_context & operator=(network_context &&)=delete
static network_context & instance()
Get the singleton instance.
bool is_initialized() const
Check if context is initialized.
network_context(const network_context &)=delete
Logger system integration interface for network_system.
Monitoring system integration interface for network_system.
VoidResult initialize()
Initialize the network system with default production configuration.
Thread system integration interface for network_system.