File StatesHandler.h

Copyright

This code is licensed under the 3-clause BSD license.

Copyright ETH Zurich, Laboratory for Physical Chemistry, Reiher Group.

See LICENSE.txt for details.

namespace Scine

This header file contains functions that allow for common notation for common things that can be done at a different degree of derivatives.

This header contains alias definitions defining which classes to use for the different degrees of derivatives.

namespace Utils
class EmptyStatesHandlerContainer : public exception
#include <StatesHandler.h>

This exception is thrown if an empty states handler is popped.

Private Functions

const char *what() const
class StatesHandler
#include <StatesHandler.h>

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 Types

using StatesContainer = std::deque<std::shared_ptr<State>>

Public Functions

StatesHandler()
virtual ~StatesHandler()
void store(std::shared_ptr<State> state)

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.

virtual void load(std::shared_ptr<State>)

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.

Protected Attributes

StatesContainer states_