5 #include <websocketpp/config/asio_no_tls_client.hpp> 6 #include <websocketpp/client.hpp> 7 #include <websocketpp/common/thread.hpp> 8 #include <websocketpp/common/functional.hpp> 10 #include <glibmm/spawn.h> 12 typedef websocketpp::client<websocketpp::config::asio_client>
WSClient;
13 typedef websocketpp::config::asio_client::message_type::ptr
message_ptr;
14 typedef websocketpp::lib::lock_guard<websocketpp::lib::mutex>
scoped_lock;
40 ComputeThread(
int server_port=0, std::string token=
"", std::string ip_address=
"127.0.0.1");
87 bool complete(DTree::iterator,
int pos,
int alternative);
125 void on_open(websocketpp::connection_hdl hdl);
126 void on_fail(websocketpp::connection_hdl hdl);
127 void on_close(websocketpp::connection_hdl hdl);
void try_spawn_server()
Definition: ComputeThread.cc:169
std::string forced_server_token
Definition: ComputeThread.hh:145
void set_master(GUIBase *, DocumentThread *)
Determine the objects that this compute thread should be talking to.
Definition: ComputeThread.cc:43
void on_fail(websocketpp::connection_hdl hdl)
Definition: ComputeThread.cc:147
Abstract base class with methods that need to be implemented by any GUI.
Definition: GUIBase.hh:16
void on_message(websocketpp::connection_hdl hdl, message_ptr msg)
Definition: ComputeThread.cc:274
websocketpp::lib::lock_guard< websocketpp::lib::mutex > scoped_lock
Definition: ComputeThread.hh:14
WSClient::connection_ptr connection
Definition: ComputeThread.hh:120
void cell_finished_running(DataCell::id_t)
Definition: ComputeThread.cc:263
int number_of_cells_executing(void) const
Definition: ComputeThread.cc:546
std::vector< uint64_t > console_child_ids
Definition: ComputeThread.hh:137
unsigned short port
Definition: ComputeThread.hh:142
void execute_cell(DTree::iterator)
In order to execute code on the server, call the following from the GUI thread.
Definition: ComputeThread.cc:473
websocketpp::connection_hdl our_connection_hdl
Definition: ComputeThread.hh:121
DocumentThread * docthread
Definition: ComputeThread.hh:103
A base class with all the logic to manipulate a Cadabra notebook document.
Definition: DocumentThread.hh:40
bool complete(DTree::iterator, int pos, int alternative)
Request completion of a string.
Definition: ComputeThread.cc:600
void try_connect()
Definition: ComputeThread.cc:57
void stop()
Stop the current cell execution on the server and remove all other cells from the run queue as well...
Definition: ComputeThread.cc:551
void run()
Main entry point, which will connect to the server and then start an event loop to handle communicati...
Definition: ComputeThread.cc:96
std::thread::id gui_thread_id
Definition: ComputeThread.hh:108
std::string authentication_token
Definition: ComputeThread.hh:143
GUIBase * gui
Definition: ComputeThread.hh:102
void execute_interactive(const std::string &code)
Definition: ComputeThread.cc:442
void on_close(websocketpp::connection_hdl hdl)
Definition: ComputeThread.cc:249
void register_interactive_cell(uint64_t id)
Definition: ComputeThread.cc:468
bool restarting_kernel
Definition: ComputeThread.hh:119
int server_stdout
Definition: ComputeThread.hh:141
Functions to handle the exchange properties of two or more symbols in a product.
Definition: Adjform.cc:83
std::string forced_server_ip_address
Definition: ComputeThread.hh:146
int server_stderr
Definition: ComputeThread.hh:141
void terminate()
Terminate the compute thread, in preparation for shutting down the client altogether.
Definition: ComputeThread.cc:108
int forced_server_port
Definition: ComputeThread.hh:144
std::map< DataCell::id_t, DTree::iterator > running_cells
Definition: ComputeThread.hh:115
Glib::Pid server_pid
Definition: ComputeThread.hh:140
~ComputeThread()
Definition: ComputeThread.cc:31
websocketpp::client< websocketpp::config::asio_client > WSClient
Definition: ComputeThread.hh:12
ComputeThread(int server_port=0, std::string token="", std::string ip_address="127.0.0.1")
If the ComputeThread is constructed with a null pointer to the gui, there will be no gui updates...
Definition: ComputeThread.cc:19
uint64_t interactive_cell
Definition: ComputeThread.hh:136
void restart_kernel()
Restart the kernel.
Definition: ComputeThread.cc:571
void all_cells_nonrunning()
Set all cells to be non-running (e.g.
Definition: ComputeThread.cc:133
Base class which talks to the server and sends Action objects back to the DocumentThread.
Definition: ComputeThread.hh:35
void init()
Definition: ComputeThread.cc:49
bool connection_is_open
Definition: ComputeThread.hh:119
Each cell is identified by a serial number 'id' which is used to keep track of it across network call...
Definition: DataCell.hh:51
WSClient wsclient
Definition: ComputeThread.hh:118
websocketpp::config::asio_client::message_type::ptr message_ptr
Definition: ComputeThread.hh:13
void on_open(websocketpp::connection_hdl hdl)
Definition: ComputeThread.cc:222