WebCFace 2.5.2
Web-based Communication Framework & Dashboard-like UI
Loading...
Searching...
No Matches
server.h
Go to the documentation of this file.
1#pragma once
2#ifdef WEBCFACE_MESON
3#include "webcface-config.h"
4#else
5#include "webcface/common/webcface-config.h"
6#endif
7#include <spdlog/common.h>
8#include <spdlog/logger.h>
9#include <condition_variable>
10#include <mutex>
11#include <memory>
12#include <thread>
13#include <atomic>
14#include <vector>
15
17namespace server {
18class ServerStorage;
19struct MemberData;
20
21using wsConnPtr = void *;
22
23void initVips();
24
25class Server {
26 std::atomic<bool> server_stop;
27 std::mutex server_mtx;
28 std::vector<void *> apps;
29 std::vector<std::thread> apps_running;
30
31 void pingThreadMain();
32
33 void send(wsConnPtr conn, const std::string &msg);
34
35 public:
36 friend MemberData;
37 std::condition_variable server_ping_wait;
38 std::unique_ptr<ServerStorage> store;
39
40 private:
41 std::thread ping_thread; // storeよりも後ろ
42
43 public:
44 Server(std::uint16_t port, int level, int keep_log = 1000,
45 spdlog::sink_ptr sink = nullptr,
46 std::shared_ptr<spdlog::logger> logger = nullptr);
47 ~Server();
48 void join();
49 void stop();
50
51 Server(const Server &) = delete;
52 Server &operator=(const Server &) = delete;
53 Server(Server &&) = delete;
54 Server &operator=(Server &&) = delete;
55};
56} // namespace server
Definition server.h:25
friend MemberData
Definition server.h:36
Server & operator=(Server &&)=delete
Server & operator=(const Server &)=delete
std::condition_variable server_ping_wait
Definition server.h:37
Server(Server &&)=delete
std::unique_ptr< ServerStorage > store
Definition server.h:38
Server(const Server &)=delete
void * wsConnPtr
Definition server.h:21
void initVips()
Definition image_conversion.cc:15
#define WEBCFACE_NS_END
Definition webcface-config.h:104
#define WEBCFACE_NS_BEGIN
Definition webcface-config.h:103