Cadabra
Computer algebra system for field theory problems
|
DataCells are the basic building blocks for a document.
They represent visual units in the notebook interface. They are stored in a tree inside the client, and can be transmitted over the wire between server and client in JSON format (see the documentation of the cadabra::JSON_serialise and cadabra::JSON_deserialise methods below for details on this representation). The notebook user interface reads these cells and construct corresponding graphical output for them.
The cadabra.display method of the cadabra python library knows how to turn various Python objects into the corresponding JSON representation of a DataCell.
#include <DataCell.hh>
Classes | |
class | id_t |
Each cell is identified by a serial number 'id' which is used to keep track of it across network calls, and a bool indicating whether the client or the server has created this cell. More... | |
Public Types | |
enum | CellType { CellType::document, CellType::python, CellType::latex, CellType::output, CellType::verbatim, CellType::latex_view, CellType::input_form, CellType::image_png, CellType::error } |
Cells are labelled with the data type of its contents, which is stored in a textural representation but may need processing for proper display. More... | |
Public Member Functions | |
DataCell (CellType t=CellType::python, const std::string &str="", bool hidden=false) | |
Standard constructor, generates a new unique id for this DataCell. More... | |
DataCell (id_t, CellType t=CellType::python, const std::string &str="", bool hidden=false) | |
Initialise a cell with an already determined id (it is the caller's responsibility to ensure that this id does not clash with any other DataCell's id). More... | |
DataCell (const DataCell &) | |
Copy constructor; preserves all information including id. More... | |
id_t | id () const |
Public Attributes | |
CellType | cell_type |
std::string | textbuf |
Textual representation of the cell content. More... | |
bool | hidden |
Flag indicating whether this cell should be hidden from view. More... | |
bool | sensitive |
bool | running |
Indicator whether this cell is currently being evaluated by the server. More... | |
Private Attributes | |
id_t | serial_number |
Static Private Attributes | |
static std::mutex | serial_mutex |
static uint64_t | max_serial_number =1 |
|
strong |
Cells are labelled with the data type of its contents, which is stored in a textural representation but may need processing for proper display.
DataCell::DataCell | ( | CellType | t = CellType::python , |
const std::string & | str = "" , |
||
bool | hidden = false |
||
) |
Standard constructor, generates a new unique id for this DataCell.
DataCell::DataCell | ( | id_t | id_, |
CellType | t = CellType::python , |
||
const std::string & | str = "" , |
||
bool | hidden = false |
||
) |
Initialise a cell with an already determined id (it is the caller's responsibility to ensure that this id does not clash with any other DataCell's id).
DataCell::DataCell | ( | const DataCell & | other | ) |
Copy constructor; preserves all information including id.
DataCell::id_t DataCell::id | ( | ) | const |
CellType cadabra::DataCell::cell_type |
bool cadabra::DataCell::hidden |
Flag indicating whether this cell should be hidden from view.
The GUI should have a way to bring the cells back into view, typically by clicking on the output cell corresponding to the input cell.
|
staticprivate |
bool cadabra::DataCell::running |
Indicator whether this cell is currently being evaluated by the server.
Currently only has a meaning for cells of type 'python'. This flag is set/reset using the ActionSetRunStatus action.
bool cadabra::DataCell::sensitive |
|
staticprivate |
|
private |
std::string cadabra::DataCell::textbuf |
Textual representation of the cell content.
For e.g. latex cells it is a bit of a waste to store this representation both in the input and in the output cell. However, this gives us the flexibility to do manipulations on the input (e.g. resolving equation references) before feeding it to LaTeX.