A Jupyter kernel for Cadabra, which provides the Cadabra pre-processor to enable input as in the Gtk notebook frontend.
Built using Xeus.
#include <cadabra-jupyter-kernel.hh>
|
| | CadabraJupyter () |
| |
| virtual | ~CadabraJupyter ()=default |
| |
| virtual uint64_t | send (const std::string &output, const std::string &msg_type, uint64_t parent_id, bool last) override |
| | Raw code to send a string (which must be JSON formatted) as a message to the client.
|
| |
| | Server () |
| |
| | Server (const Server &)=delete |
| |
| | Server (const std::string &socket) |
| |
| virtual | ~Server () |
| |
| void | run (int port=0, bool exit_on_disconnect=true) |
| | The only user-visible part: just instantiate a server object and start it with run().
|
| |
| virtual uint64_t | send (const std::string &output, const std::string &msg_type, uint64_t parent_id=0, bool last_in_sequence=false) |
| | Raw code to send a string (which must be JSON formatted) as a message to the client.
|
| |
| void | send_progress_update (const std::string &msg, int n, int total) |
| |
| void | send_json (const std::string &) |
| |
| bool | handles (const std::string &otype) const |
| |
| std::string | architecture () const |
| |
| void | wait_for_job () |
| | Start a thread which waits for blocks to appear on the block queue, and executes them in turn.
|
| |
|
| virtual void | on_block_error (Block) override |
| |
| void | init () |
| |
| void | on_socket_init (websocketpp::connection_hdl hdl, boost::asio::ip::tcp::socket &s) |
| |
| void | on_message (websocketpp::connection_hdl hdl, WebsocketServer::message_ptr msg) |
| |
| void | on_open (websocketpp::connection_hdl hdl) |
| |
| void | on_close (websocketpp::connection_hdl hdl) |
| |
| std::string | run_string (const std::string &, bool handle_output=true) |
| |
| virtual void | on_block_finished (Block) |
| | Called by the run_block() thread upon completion of the task.
|
| |
| virtual void | on_block_error (Block) |
| |
| virtual void | on_kernel_fault (Block) |
| |
| void | stop_block () |
| | Halt the currently running block and prevent execution of any further blocks that may still be on the queue.
|
| |
| void | dispatch_message (websocketpp::connection_hdl, const std::string &json_string) |
| | Takes a JSON encoded message and performs the required action to process it.
|
| |
◆ CadabraJupyter()
| cadabra::CadabraJupyter::CadabraJupyter |
( |
| ) |
|
◆ ~CadabraJupyter()
| virtual cadabra::CadabraJupyter::~CadabraJupyter |
( |
| ) |
|
|
virtualdefault |
◆ complete_request_impl()
| xjson cadabra::CadabraJupyter::complete_request_impl |
( |
const std::string & |
code, |
|
|
int |
cursor_pos |
|
) |
| |
|
overrideprivate |
◆ configure_impl()
| void cadabra::CadabraJupyter::configure_impl |
( |
| ) |
|
|
overrideprivate |
◆ execute_request_impl()
| xjson cadabra::CadabraJupyter::execute_request_impl |
( |
int |
execution_counter, |
|
|
const std::string & |
code, |
|
|
bool |
silent, |
|
|
bool |
store_history, |
|
|
xjson |
user_expressions, |
|
|
bool |
allow_stdin |
|
) |
| |
|
overrideprivate |
◆ inspect_request_impl()
| xjson cadabra::CadabraJupyter::inspect_request_impl |
( |
const std::string & |
code, |
|
|
int |
cursor_pos, |
|
|
int |
detail_level |
|
) |
| |
|
overrideprivate |
◆ is_complete_request_impl()
| xjson cadabra::CadabraJupyter::is_complete_request_impl |
( |
const std::string & |
code | ) |
|
|
overrideprivate |
◆ kernel_info_request_impl()
| xjson cadabra::CadabraJupyter::kernel_info_request_impl |
( |
| ) |
|
|
overrideprivate |
◆ on_block_error()
| void cadabra::CadabraJupyter::on_block_error |
( |
Block |
blk | ) |
|
|
overrideprotectedvirtual |
◆ send()
| uint64_t cadabra::CadabraJupyter::send |
( |
const std::string & |
output, |
|
|
const std::string & |
msg_type, |
|
|
uint64_t |
parent_id, |
|
|
bool |
last_in_sequence |
|
) |
| |
|
overridevirtual |
Raw code to send a string (which must be JSON formatted) as a message to the client.
Handles communication of the result back to the client in JSON format. This is always of the form
{ "header": { "parent_id": "...",
"parent_origin": "client" | "server",
"cell_id": "...",
"cell_origin": "client" | "server"
},
"content": { "output": "..." },
"msg_type": "..."
}
msg_type can be "output", "latex", "image_png" and so on, corresponding to the possible values of DataCell::CellType.
Returns the serial number of the new cell sent.
Reimplemented from Server.
◆ shutdown_request_impl()
| void cadabra::CadabraJupyter::shutdown_request_impl |
( |
| ) |
|
|
overrideprivate |
◆ current_counter
| int cadabra::CadabraJupyter::current_counter |
◆ finished
| bool cadabra::CadabraJupyter::finished =true |
The documentation for this class was generated from the following files: