dirty_cell_tracker
Defined in header: <ixion/dirty_cell_tracker.hpp>
-
class dirty_cell_tracker
This class is designed to track in-direct dependencies of dirty formula cells. A “dirty” formula cell is a formula cell whose result needs to be re-calculated because at one or more of its references have updated values.
This class also takes volatile functions into account when determining the status of the formula cell result. A volatile function is a cell function whose value needs to be re-calculated on every re-calculation. One example of a volatile function is NOW(), which returns the current time at the time of calculation.
Public Functions
-
dirty_cell_tracker(const dirty_cell_tracker&) = delete
-
dirty_cell_tracker &operator=(const dirty_cell_tracker&) = delete
-
dirty_cell_tracker()
-
~dirty_cell_tracker()
-
void add(const abs_range_t &src, const abs_range_t &dest)
Add a tracking relationship from a source cell or cell range to a destination cell or cell range.
- Parameters:
src – source cell or cell range that includes reference to (therefore listens to) the range.
dest – destination cell or range referenced tracked by the source cell.
-
void remove(const abs_range_t &src, const abs_range_t &dest)
Remove an existing tracking relationship from a source cell or cell range to a destination cell or cell range. If no such relationship exists, it does nothing.
- Parameters:
src – cell or cell range that includes reference to the range.
dest – cell or range referenced by the cell.
-
void add_volatile(const abs_range_t &pos)
Register a formula cell located at the specified position as volatile. Note that the caller should ensure that the cell at the specified position is indeed a formula cell.
- Parameters:
pos – position of the cell to register as a volatile cell.
-
void remove_volatile(const abs_range_t &pos)
Remove the specified cell position from the internal set of registered volatile formula cells.
- Parameters:
pos – position of the cell to unregister as a volatile cell.
-
abs_range_set_t query_dirty_cells(const abs_range_t &modified_cell) const
Get the positions of the formula cells that need re-calculating after a modification: the registered volatile cells, and the cells that directly or indirectly reference the modified cell.
- Parameters:
modified_cell – Cell or range whose value has been modified.
- Returns:
Positions of the dirty formula cells, in no particular order. A formula group appears as a single range.
-
abs_range_set_t query_dirty_cells(const abs_range_set_t &modified_cells) const
Get the positions of the formula cells that need re-calculating after modifications: the registered volatile cells, and the cells that directly or indirectly reference any of the modified cells.
- Parameters:
modified_cells – Cells or ranges whose values have been modified.
- Returns:
Positions of the dirty formula cells, in no particular order. A formula group appears as a single range.
-
std::vector<abs_range_t> query_and_sort_dirty_cells(const abs_range_t &modified_cell) const
Get the positions of the formula cells that need re-calculating after a modification, sorted in order of dependency so that each cell comes after the cells it depends on.
- Parameters:
modified_cell – Cell or range whose value has been modified.
- Returns:
Positions of the dirty formula cells in calculation order. A formula group appears as a single range.
-
std::vector<abs_range_t> query_and_sort_dirty_cells(const abs_range_set_t &modified_cells, const abs_range_set_t *dirty_formula_cells = nullptr) const
Get the positions of the formula cells that need re-calculating after modifications, sorted in order of dependency so that each cell comes after the cells it depends on.
- Parameters:
modified_cells – Cells or ranges whose values have been modified.
dirty_formula_cells – Formula cells to treat as dirty regardless of the modifications, such as cells whose formulas are new or have changed. Their dependents get included as well.
- Returns:
Positions of the dirty formula cells in calculation order. A formula group appears as a single range.
-
std::string to_string() const
Get a string representation of all tracked relationships, for debugging.
-
bool empty() const
Check whether the tracker has any tracked relationship. Registered volatile cells are not taken into account.
-
dirty_cell_tracker(const dirty_cell_tracker&) = delete