Formula Engine

void ixion::parse_formula_string(iface::formula_model_access &cxt, const abs_address_t &pos, const formula_name_resolver &resolver, const char *p, size_t n, formula_tokens_t &tokens)

Parse a raw formula expression string into formula tokens.

Parameters
  • cxt: model context.
  • pos: address of the cell that has the formula expression.
  • resolver: name resolver object used to resolve name tokens.
  • p: pointer to the first character of raw formula expression string.
  • n: size of the raw formula expression string.
  • tokens: formula tokens representing the parsed formula expression.

void ixion::print_formula_tokens(const iface::formula_model_access &cxt, const abs_address_t &pos, const formula_name_resolver &resolver, const formula_tokens_t &tokens, std::string &str)

Convert formula tokens into a human-readable string representation.

Parameters
  • cxt: model context.
  • pos: address of the cell that has the formula tokens.
  • resolver: name resolver object used to print name tokens.
  • tokens: formula tokens.
  • str: string representation of the formula tokens.

void ixion::register_formula_cell(iface::formula_model_access &cxt, const abs_address_t &pos)

Regisiter a formula cell with cell dependency tracker.

Parameters
  • cxt: model context.
  • pos: address of the cell being registered.

void ixion::unregister_formula_cell(iface::formula_model_access &cxt, const abs_address_t &pos)

Unregister a formula cell with cell dependency tracker if a formula cell exists at specified cell address. If there is no existing cell at the specified address, or the cell is not a formula cell, this function is a no-op.

Parameters
  • cxt: model context.
  • pos: address of the cell being unregistered.

void ixion::get_all_dirty_cells(iface::formula_model_access &cxt, modified_cells_t &addrs, dirty_formula_cells_t &cells)

Get all cells that directly or indirectly depend on known modified cells. We call such cells “dirty cells”.

Parameters
  • cxt: model context
  • addrs: list of addresses of cells that have been modified. Note that this call may add additional cells to this list in a presence of volatile cells.
  • cells: all dirty cells are inserted into this container when this function returns.

void ixion::calculate_cells(iface::formula_model_access &cxt, dirty_formula_cells_t &cells, size_t thread_count)

Calculate all dirty cells in order of dependency.

Parameters
  • cxt: model context.
  • cells: all dirty cells to be calculated.
  • thread_count: number of calculation threads to use. Note that passing 0 will make the process use the main thread only, while passing any number greater than 0 will make the process spawn specified number of calculation threads plus one additional thread to manage the calculation threads.