Class Scine::Utils::StatesHandler¶
-
class
StatesHandler¶ Base class for the implementation of a generic saving and loading capability.
Implementation note: If a class having an interface needs to save/load a state, then it has to populate the polymorphic pointers to the State class with a derived class, specific to the class.
Subclassed by Scine::Utils::ExternalQC::OrcaStatesHandler
Public Functions
Store a state as the newest state.
- Parameters
state: A pointer to the state to store internally.
-
virtual void
store(StateSize)¶ Internally store the current state as the newest state.
- Parameters
size: The required size of the state to save.
Loads a state, i.e.
it applies it.
- Parameters
state: The state to be loaded. Can also be one of the states currently stored in the StatesHandler.
-
std::shared_ptr<State>
getState(int index)¶ Gets the state with the index i.
- Return
A polymorphic smart pointer to the State at index i.
-
virtual std::shared_ptr<State>
getCurrentState(StateSize) const = 0¶ Gets the current state without the need to load it.
- Return
A polymorphic shared pointer to the current State.
-
std::shared_ptr<State>
popOldestState()¶ Eliminates from the underlying container and returns the oldest state recorded.
-
std::shared_ptr<State>
popNewestState()¶ Eliminates from the underlying container and returns the newest state recorded.
-
void
clear()¶ Clear all the internally saved states.
-
int
size() const¶ Get the current size of the state storage.
- Return
The number of states currently saved.