File: cadabra-jupyter-kernel.hh

package info (click to toggle)
cadabra2 2.4.3.2-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 78,732 kB
  • sloc: ansic: 133,450; cpp: 92,064; python: 1,530; javascript: 203; sh: 184; xml: 182; objc: 53; makefile: 51
file content (57 lines) | stat: -rw-r--r-- 1,521 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57

#pragma once

#include "xeus/xinterpreter.hpp"
#include "xeus/xjson.hpp"
#include "Server.hh"

using xeus::xinterpreter;
using xeus::xjson;

namespace cadabra {

	/// \ingroup clientserver
	///
	/// A Jupyter kernel for Cadabra, which provides the Cadabra
	/// pre-processor to enable input as in the Gtk notebook frontend.
	/// Built using Xeus.

	class CadabraJupyter : public xinterpreter, public Server {
		public:

			CadabraJupyter();
			virtual ~CadabraJupyter() = default;

			virtual uint64_t send(const std::string& output, const std::string& msg_type, uint64_t parent_id, bool last) override;

			int current_counter;
			bool finished=true;

		protected:
			virtual void   on_block_error(Block) override;

		private:

			void configure_impl() override;

			xjson execute_request_impl(int execution_counter,
			                           const std::string& code,
			                           bool silent,
			                           bool store_history,
			                           xjson user_expressions,
			                           bool allow_stdin) override;

			xjson complete_request_impl(const std::string& code,
			                            int cursor_pos) override;

			xjson inspect_request_impl(const std::string& code,
			                           int cursor_pos,
			                           int detail_level) override;

			xjson is_complete_request_impl(const std::string& code) override;

			xjson kernel_info_request_impl() override;

			void shutdown_request_impl() override;
		};
	}