Cadabra
Computer algebra system for field theory problems
Classes
Client-Server

Module Description

Base classes (independent of any GUI toolkit) to write Cadabra clients and servers.

All clients use two threads. One is the main thread and runs most of the logic in the DocumentThread object. The other one is a thread which communicates with the server process; code for this thread is in the ComputeThread object. One typically subclasses the former into a full-fledged object driving the graphical user interface.

All functionality that deals with GUI updates is isolated in GUIBase. A client should derive from this abstract base class and implement the methods there. Clients should also derive from DocumentThread, but there are no abstract virtual members to implemented from this base class.

All actual updates to the document stored in the DocumentThread::dtree member are made on the GUI thread as well. The compute thread merely puts requests to change the document onto a stack, and then requests that the GUI updates the document.

In order to enable undo/redo, all updates to DocumentThread::dtree are made by putting objects derived from ActionBase onto the action stack. See DocumentThread::queue_action for details. These ActionBase objects (among which ActionAddCell, ActionRemoveCell, ActionInsertText, etc) get executed on the GUI thread, and contain the actual logic to perform updates to the document and related GUI elements.

Classes

class  cadabra::ActionBase
 All actions derive from the ActionBase object, which defines the interface they need to implement. More...
 
class  cadabra::ActionAddCell
 Add a cell to the notebook. More...
 
class  cadabra::ActionPositionCursor
 Position the cursor relative to the indicated cell. More...
 
class  cadabra::ActionSetRunStatus
 Update the running status of the indicated cell. More...
 
class  cadabra::ActionRemoveCell
 Remove a cell and all its child cells from the document. More...
 
class  cadabra::ActionReplaceCell
 Replace the contents of a cell. More...
 
class  cadabra::ActionSplitCell
 Split a cell into two separate cells, at the point of the cursor. More...
 
class  cadabra::ActionInsertText
 Add a text string (can be just a single character) at the point of the cursor. More...
 
class  cadabra::ActionCompleteText
 Complete text at a point in a GUI cell with one or more alternative. More...
 
class  cadabra::ActionEraseText
 Remove a text string starting at the indicated position, and with the indicated length, from the indicated cell. More...
 
class  cadabra::CadabraJupyter
 A Jupyter kernel for Cadabra, which provides the Cadabra pre-processor to enable input as in the Gtk notebook frontend. More...
 
class  cadabra::ComputeThread
 Base class which talks to the server and sends Action objects back to the DocumentThread. More...
 
class  cadabra::DocumentThread
 A base class with all the logic to manipulate a Cadabra notebook document. More...
 
class  cadabra::GUIBase
 Abstract base class with methods that need to be implemented by any GUI. More...
 
class  Server
 Object representing a Cadabra server, capable of receiving messages on a websocket, running Python code, and sending output back to the client. More...