File GenericInstanceEditor.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
namespace UniversalSettings
template<typename BaseT>
class GenericInstanceEditor
#include <GenericInstanceEditor.h>

Same as GenericInstanceEditor, defined below, without create function for the case that the constructor needs more parameters, which can then be specified in the derived class.

Public Types

template<>
using BaseClass = BaseT

Public Functions

virtual ~GenericInstanceEditor()
virtual DescriptorCollection getSettingDescriptors() const = 0

Get the descriptors for the settings for BaseClass.

virtual ValueCollection getAppliedSettings(const BaseClass &instance) const = 0

Get the current parameters for the given instance.

virtual bool relatesToInstance(const BaseClass &instance) const = 0

Enquire whether the Editor class can handle the given instance.

virtual void apply(BaseClass &instance, const ValueCollection &values) const = 0

Apply settings to some BaseClass instance.

template<typename Base>
class GenericInstanceEditorWithDefaultConstructor : public Scine::Utils::UniversalSettings::GenericInstanceEditor<Base>
#include <GenericInstanceEditor.h>

Template for a class being able to create and modify instances of some polymorphic type from settings specified in the UniversalSettings syntax.

Public Types

template<>
using BaseClass = Base

Public Functions

virtual std::unique_ptr<Base> create(const ValueCollection &values) const = 0

Create an instance with given setting values.

std::unique_ptr<Base> createDefault() const

Create an instance with default values.

template<typename BaseEditor, typename T>
class GenericInstanceEditorImpl : public BaseEditor
#include <GenericInstanceEditor.h>

Specification of GenericInstanceEditorWithoutCreateFunction with the type T, to generate automatically some of the virtual functions.

Template Parameters
  • BaseEditor: must be some GenericInstanceEditor

  • T: class to instantiate, must be a * derived class of the template parameter of BaseEditor.

Subclassed by Scine::Utils::UniversalSettings::GenericInstanceEditorWithDefaultConstructorImpl< BaseEditor, T >

Public Types

template<>
using InstanceClass = T
template<>
using BaseClass = typename BaseEditor::BaseClass

Public Functions

bool relatesToInstance(const BaseClass &instance) const
void apply(BaseClass &instance, const ValueCollection &values) const
ValueCollection getAppliedSettings(const BaseClass &instance) const

Protected Functions

T &castDown(BaseClass &instance) const
const T &castDown(const BaseClass &instance) const

Private Functions

virtual void applyImpl(T &instance, const ValueCollection &values) const = 0
virtual ValueCollection getAppliedSettingsImpl(const T &instance) const = 0
template<typename BaseEditor, typename T>
class GenericInstanceEditorWithDefaultConstructorImpl : public Scine::Utils::UniversalSettings::GenericInstanceEditorImpl<BaseEditor, T>
#include <GenericInstanceEditor.h>

Specification of GenericInstanceEditor with the type T, to generate automatically some of the virtual functions.

Template Parameters

Public Types

template<>
using InstanceClass = T
template<>
using BaseClass = typename BaseEditor::BaseClass

Public Functions

std::unique_ptr<BaseClass> create(const ValueCollection &values) const