r-type  0.0.0
R-Type main
Loading...
Searching...
No Matches
server.cpp
Go to the documentation of this file.
1#include <thread>
2
4#include "Server/Common.hpp"
6#include "Server/Server.hpp"
7#include "Utils/Logger.hpp"
8
10 : m_pluginLoader(std::make_unique<utl::PluginLoader>()),
11 m_network(m_pluginLoader->loadPlugin<INetworkServer>(!config.network_lib_path.empty()
12 ? config.network_lib_path
13 : Path::Plugin::PLUGINS_NETWORK_ASIO_SERVER.string()))
14{
15 utl::Logger::log("PROJECT INFO:", utl::LogLevel::INFO);
16 std::cout << "\tName: " PROJECT_NAME "\n"
17 "\tVersion: " PROJECT_VERSION "\n"
18 "\tBuild type: " BUILD_TYPE "\n"
19 "\tGit tag: " GIT_TAG "\n"
20 "\tGit commit hash: " GIT_COMMIT_HASH "\n";
21
22 m_network->init(config.host, config.port);
23}
24
25void srv::Server::run() const
26{
27 m_network->start();
28 for (;;)
29 {
30 std::this_thread::sleep_for(std::chrono::seconds(1));
31 }
32}
This file contains the Logger class.
This file contains the Server class declaration.
Interface for the server network.
void run() const
Definition server.cpp:25
Server(const ArgsConfig &config)
Definition server.cpp:9
std::shared_ptr< INetworkServer > m_network
Definition Server.hpp:39
static void log(const std::string &message, const LogLevel &logLevel)
Definition Logger.hpp:51
#define BUILD_TYPE
Definition Version.hpp:15
#define PROJECT_VERSION
Definition Version.hpp:8
#define GIT_TAG
Definition Version.hpp:14
#define PROJECT_NAME
Definition Version.hpp:7
#define GIT_COMMIT_HASH
Definition Version.hpp:13
This file contains the ArgsHandler class declaration.
This file contains common definitions and constants.
std::string host