|
Gromacs
2018.6
|
#include <gromacs/options/valueconverter.h>
Helper for converting from Variant to a given type.
| OutType | Type this converter converts to. |
Default-constructed converter only supports identity mapping from the a Variant holding OutType. To add support for additional input types, provide conversion functions with addConverter(). To use a non-identity mapping for an OutType -> OutType conversion, provide an alternative conversion from OutType with addConverter().
Public Member Functions | |
| OutType | convert (const Variant &value) const |
| Converts a Variant value to the output type. More... | |
| template<typename InType > | |
| void | addConverter (std::function< OutType(const InType &)> func) |
| Adds a supported conversion. More... | |
| template<typename InType > | |
| void | addCastConversion () |
| Adds a supported conversion from a type that can be directly cast. More... | |
|
inline |
Adds a supported conversion from a type that can be directly cast.
| InType | Type to convert from with a simple cast. |
|
inline |
Adds a supported conversion.
| InType | Type to convert from. |
| func | Function to convert from InType to OutType. |
|
inline |
Converts a Variant value to the output type.
| InvalidInputError | If the input Variant has a type that is not recognized by any conversion. |
1.8.5