yaze
0.3.2
Link to the Past ROM Editor
Loading...
Searching...
No Matches
http_server.h
Go to the documentation of this file.
1
#ifndef YAZE_SRC_CLI_SERVICE_API_HTTP_SERVER_H_
2
#define YAZE_SRC_CLI_SERVICE_API_HTTP_SERVER_H_
3
4
#include <atomic>
5
#include <memory>
6
#include <string>
7
#include <thread>
8
9
#include "absl/status/status.h"
10
11
// Forward declaration
12
namespace
httplib
{
13
class
Server;
14
}
15
16
namespace
yaze
{
17
namespace
cli {
18
namespace
api {
19
20
class
HttpServer
{
21
public
:
22
HttpServer
();
23
~HttpServer
();
24
25
// Start the server on the specified port in a background thread.
26
absl::Status
Start
(
int
port);
27
28
// Stop the server.
29
void
Stop
();
30
31
// Check if server is running
32
bool
IsRunning
()
const
;
33
34
private
:
35
void
RunServer
(
int
port);
36
void
RegisterRoutes
();
37
38
std::unique_ptr<httplib::Server>
server_
;
39
std::unique_ptr<std::thread>
server_thread_
;
40
std::atomic<bool>
is_running_
{
false
};
41
};
42
43
}
// namespace api
44
}
// namespace cli
45
}
// namespace yaze
46
47
#endif
// YAZE_SRC_CLI_SERVICE_API_HTTP_SERVER_H_
yaze::cli::api::HttpServer
Definition
http_server.h:20
yaze::cli::api::HttpServer::server_
std::unique_ptr< httplib::Server > server_
Definition
http_server.h:38
yaze::cli::api::HttpServer::Stop
void Stop()
Definition
http_server.cc:51
yaze::cli::api::HttpServer::HttpServer
HttpServer()
Definition
http_server.cc:16
yaze::cli::api::HttpServer::RunServer
void RunServer(int port)
yaze::cli::api::HttpServer::~HttpServer
~HttpServer()
Definition
http_server.cc:18
yaze::cli::api::HttpServer::Start
absl::Status Start(int port)
Definition
http_server.cc:22
yaze::cli::api::HttpServer::IsRunning
bool IsRunning() const
Definition
http_server.cc:63
yaze::cli::api::HttpServer::RegisterRoutes
void RegisterRoutes()
Definition
http_server.cc:67
yaze::cli::api::HttpServer::server_thread_
std::unique_ptr< std::thread > server_thread_
Definition
http_server.h:39
yaze::cli::api::HttpServer::is_running_
std::atomic< bool > is_running_
Definition
http_server.h:40
httplib
Definition
httplib_client.h:10
yaze
Definition
application.cc:18
src
cli
service
api
http_server.h
Generated by
1.10.0