Expand description
Undo and redo for every mutator (#465).
History is off by default: IfcModel::set_history_limit turns it on
with a bound on the number of undo entries. While it is on, each public
mutator is one entry: the exact inverse of every primitive write it made,
recorded by ifc::History::track. IfcModel::undo restores the model
to the state before the last entry (entities under their ids, at their
file positions, the header included) and IfcModel::redo reverses an
undo. A mutator that is refused and changed nothing records nothing; a
dry run records nothing.
Undoing the creation of an entity frees its id again, so a later call may reuse it. Undo and redo are new changes: the model revision moves on.
A change made outside the history (a mutator while the limit was 0, or a
write through the facade) makes the stacks stale: undo and redo are
refused with history-stale and change nothing, and the next recorded
change drops the stale entries. An empty stack is history-empty.
Structsยง
- History
Change - What an undo or redo restores (or would restore): ids in order of first occurrence in the change.
- History
State - How much history a model holds:
IfcModel::history.