Cadabra
Computer algebra system for field theory problems
Toggle main menu visibility
Loading...
Searching...
No Matches
client_server
ScriptThread.hh
Go to the documentation of this file.
1
2
#pragma once
3
4
#include "
websocket_server.hh
"
5
#include <future>
6
7
8
namespace
cadabra
{
9
20
21
class
DocumentThread
;
22
class
GUIBase
;
23
24
class
ScriptThread
{
25
public
:
26
ScriptThread
(
DocumentThread
*,
GUIBase
*);
27
~ScriptThread
();
28
29
ScriptThread
(
const
ScriptThread
&) =
delete
;
30
31
void
run
();
32
void
terminate
();
33
34
uint16_t
get_local_port
()
const
;
35
std::string
get_authentication_token
()
const
;
36
37
private
:
38
void
on_message
(
websocket_server::id_type
id
,
const
std::string& msg,
39
const
websocket_server::request_type
& req,
const
std::string& ip_address);
40
void
on_open
(
websocket_server::id_type
id
);
41
void
on_close
(
websocket_server::id_type
id
);
42
43
websocket_server
wserver
;
44
DocumentThread
*
document
;
45
GUIBase
*
gui
;
46
47
// Authentication token, needs to be sent along with any message.
48
// Gets shown when we start up.
49
std::string
authentication_token
;
50
uint16_t
local_port
;
51
// Fulfilled by run() once local_port is known.
52
std::promise<void>
url_promise
;
53
std::shared_future<void>
url_ready
;
54
};
55
56
}
cadabra::DocumentThread
A base class with all the logic to manipulate a Cadabra notebook document.
Definition
DocumentThread.hh:41
cadabra::GUIBase
Abstract base class with methods that need to be implemented by any GUI.
Definition
GUIBase.hh:16
cadabra::ScriptThread::run
void run()
Definition
ScriptThread.cc:162
cadabra::ScriptThread::on_close
void on_close(websocket_server::id_type id)
Definition
ScriptThread.cc:40
cadabra::ScriptThread::on_open
void on_open(websocket_server::id_type id)
Definition
ScriptThread.cc:29
cadabra::ScriptThread::on_message
void on_message(websocket_server::id_type id, const std::string &msg, const websocket_server::request_type &req, const std::string &ip_address)
Definition
ScriptThread.cc:53
cadabra::ScriptThread::local_port
uint16_t local_port
Definition
ScriptThread.hh:50
cadabra::ScriptThread::ScriptThread
ScriptThread(DocumentThread *, GUIBase *)
Definition
ScriptThread.cc:18
cadabra::ScriptThread::authentication_token
std::string authentication_token
Definition
ScriptThread.hh:49
cadabra::ScriptThread::url_promise
std::promise< void > url_promise
Definition
ScriptThread.hh:52
cadabra::ScriptThread::get_authentication_token
std::string get_authentication_token() const
Definition
ScriptThread.cc:189
cadabra::ScriptThread::terminate
void terminate()
Definition
ScriptThread.cc:194
cadabra::ScriptThread::url_ready
std::shared_future< void > url_ready
Definition
ScriptThread.hh:53
cadabra::ScriptThread::wserver
websocket_server wserver
Definition
ScriptThread.hh:43
cadabra::ScriptThread::get_local_port
uint16_t get_local_port() const
Definition
ScriptThread.cc:182
cadabra::ScriptThread::ScriptThread
ScriptThread(const ScriptThread &)=delete
cadabra::ScriptThread::gui
GUIBase * gui
Definition
ScriptThread.hh:45
cadabra::ScriptThread::document
DocumentThread * document
Definition
ScriptThread.hh:44
websocket_server
Definition
websocket_server.hh:16
websocket_server::request_type
boost::beast::http::request< boost::beast::http::string_body > request_type
Definition
websocket_server.hh:19
websocket_server::id_type
std::size_t id_type
Definition
websocket_server.hh:18
cadabra
Functions to handle the exchange properties of two or more symbols in a product.
Definition
Adjform.cc:83
websocket_server.hh
Generated by
1.18.0