Kurlyk
Loading...
Searching...
No Matches
AutoInitializer.hpp
Go to the documentation of this file.
1#pragma once
2#ifndef _KURLYK_STARTUP_AUTO_INITIALIZER_HPP_INCLUDED
3#define _KURLYK_STARTUP_AUTO_INITIALIZER_HPP_INCLUDED
4
7
8namespace kurlyk::startup {
9
17 public:
20 auto &instance = core::NetworkWorker::get_instance();
21# if KURLYK_HTTP_SUPPORT
23 instance.register_manager(m_http);
24# endif
25# if KURLYK_WEBSOCKET_SUPPORT
27 instance.register_manager(m_ws);
28# endif
29 instance.start(KURLYK_AUTO_INIT_USE_ASYNC);
30 }
31
36
37 private:
38# if KURLYK_HTTP_SUPPORT
39 HttpRequestManager* m_http = nullptr;
40# endif
41# if KURLYK_WEBSOCKET_SUPPORT
42 WebSocketManager* m_ws = nullptr;
43# endif
44 };
45
46} // namespace kurlyk::startup
47
51
52#endif // _KURLYK_STARTUP_AUTO_INITIALIZER_HPP_INCLUDED
Manages and processes HTTP requests using a singleton pattern.
static HttpRequestManager & get_instance()
Get the singleton instance of HttpRequestManager.
Manages WebSocket client instances, providing centralized control for processing, resetting,...
static WebSocketManager & get_instance()
Get the singleton instance of WebSocketManager.
static NetworkWorker & get_instance()
Get the singleton instance of NetworkWorker.
void shutdown()
Shuts down the worker, clearing all active requests and pending tasks.
Automatically registers and manages network task managers.
AutoInitializer()
Constructs and registers all available managers.
~AutoInitializer()
Shuts down the NetworkWorker before program termination.
#define KURLYK_AUTO_INIT_USE_ASYNC
Determines whether the NetworkWorker runs in a background thread during automatic initialization.
Definition kurlyk.hpp:20
static kurlyk::startup::AutoInitializer _kurlyk_auto_initializer