Cadabra
Computer algebra system for field theory problems
cadabra-jupyter-kernel.hh
Go to the documentation of this file.
1 
2 #pragma once
3 
4 #include "xeus/xinterpreter.hpp"
5 #include "xeus/xjson.hpp"
6 #include "Server.hh"
7 
8 using xeus::xinterpreter;
9 using xeus::xjson;
10 
11 namespace cadabra {
12 
18 
19  class CadabraJupyter : public xinterpreter, public Server {
20  public:
21 
23  virtual ~CadabraJupyter() = default;
24 
25  virtual uint64_t send(const std::string& output, const std::string& msg_type, uint64_t parent_id, bool last) override;
26 
28  bool finished=true;
29 
30  protected:
31  virtual void on_block_error(Block) override;
32 
33  private:
34 
35  void configure_impl() override;
36 
37  xjson execute_request_impl(int execution_counter,
38  const std::string& code,
39  bool silent,
40  bool store_history,
41  xjson user_expressions,
42  bool allow_stdin) override;
43 
44  xjson complete_request_impl(const std::string& code,
45  int cursor_pos) override;
46 
47  xjson inspect_request_impl(const std::string& code,
48  int cursor_pos,
49  int detail_level) override;
50 
51  xjson is_complete_request_impl(const std::string& code) override;
52 
53  xjson kernel_info_request_impl() override;
54 
55  void shutdown_request_impl() override;
56  };
57  }
Definition: Server.hh:149
Object representing a Cadabra server, capable of receiving messages on a websocket,...
Definition: Server.hh:33
A Jupyter kernel for Cadabra, which provides the Cadabra pre-processor to enable input as in the Gtk ...
Definition: cadabra-jupyter-kernel.hh:19
virtual void on_block_error(Block) override
Definition: cadabra-jupyter-kernel.cc:61
xjson is_complete_request_impl(const std::string &code) override
Definition: cadabra-jupyter-kernel.cc:138
xjson execute_request_impl(int execution_counter, const std::string &code, bool silent, bool store_history, xjson user_expressions, bool allow_stdin) override
Definition: cadabra-jupyter-kernel.cc:29
void shutdown_request_impl() override
Definition: cadabra-jupyter-kernel.cc:163
xjson inspect_request_impl(const std::string &code, int cursor_pos, int detail_level) override
Definition: cadabra-jupyter-kernel.cc:121
xjson complete_request_impl(const std::string &code, int cursor_pos) override
Definition: cadabra-jupyter-kernel.cc:104
bool finished
Definition: cadabra-jupyter-kernel.hh:28
void configure_impl() override
Definition: cadabra-jupyter-kernel.cc:17
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.
Definition: cadabra-jupyter-kernel.cc:77
CadabraJupyter()
Definition: cadabra-jupyter-kernel.cc:10
xjson kernel_info_request_impl() override
Definition: cadabra-jupyter-kernel.cc:150
int current_counter
Definition: cadabra-jupyter-kernel.hh:27
Functions to handle the exchange properties of two or more symbols in a product.
Definition: Adjform.cc:83