Cadabra
Computer algebra system for field theory problems
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Public Types | Public Member Functions | Public Attributes | Private Attributes | Static Private Attributes | List of all members
cadabra::DataCell Class Reference

Description

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
 

Member Enumeration Documentation

Cells are labelled with the data type of its contents, which is stored in a textural representation but may need processing for proper display.

Enumerator
document 

head node, only one per document

python 

input : editor cell for code in python

latex 

input : editor cell for code in latex

output 

output: cell showing python stdout, verbatim

verbatim 

output: cell showing other verbatim output

latex_view 

output: cell showing LaTeX text formatted using LaTeX

input_form 

output: cell containing input form of preceding output cell

image_png 

output: cell showing a base64 encoded PNG image

error 

output: cell showing LaTeX text for errors

Constructor & Destructor Documentation

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.

Member Function Documentation

DataCell::id_t DataCell::id ( ) const

Member Data Documentation

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.

uint64_t DataCell::max_serial_number =1
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
std::mutex DataCell::serial_mutex
staticprivate
id_t cadabra::DataCell::serial_number
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.


The documentation for this class was generated from the following files: