|
Gromacs
2025.3
|
#include <gromacs/options/valueconverter.h>
Helper for converting from Any to a given type.
| OutType | Type this converter converts to. |
Default-constructed converter only supports identity mapping from the a Any 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 Any &value) const |
| Converts a Any 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 Any value to the output type.
| InvalidInputError | If the input Any has a type that is not recognized by any conversion. |
1.8.5