File GenericValue.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
class GenericValue
#include <GenericValue.h>

Class that uniformly stores multiple types of values.

Wrapper around some parameter value that hides the actual value. Makes it possible to handle different types as one object.

Types

using IntList = std::vector<int>
using StringList = std::vector<std::string>
using CollectionList = std::vector<ValueCollection>

Special member functions

GenericValue(const GenericValue &rhs)
GenericValue(GenericValue &&rhs)
GenericValue &operator=(const GenericValue &rhs)
GenericValue &operator=(GenericValue &&rhs)
~GenericValue()

Factory functions

static GenericValue fromBool(bool v)
static GenericValue fromInt(int v)
static GenericValue fromDouble(double v)
static GenericValue fromString(std::string s)
static GenericValue fromCollection(ValueCollection s)
static GenericValue fromOptionWithSettings(ParametrizedOptionValue v)
static GenericValue fromIntList(IntList v)
static GenericValue fromStringList(const StringList &v)
static GenericValue fromCollectionList(CollectionList v)

Type determinators

bool isBool() const
bool isInt() const
bool isDouble() const
bool isString() const
bool isCollection() const
bool isOptionWithSettings() const
bool isIntList() const
bool isStringList() const
bool isCollectionList() const

Type converters

bool toBool() const
int toInt() const
double toDouble() const
std::string toString() const
ValueCollection toCollection() const
ParametrizedOptionValue toOptionWithSettings() const
IntList toIntList() const
StringList toStringList() const
CollectionList toCollectionList() const

Private Types

using ImplPtr = std::unique_ptr<Impl>

Private Functions

GenericValue()

Private constructor.

This is to avoid instantiation with an empty boost::any member where no conversions are possible and all type determinators fail.

Private Members

ImplPtr pimpl_