Jamba C++ API
4.4.0
|
This converters maps a list of values of type T
to discrete values.
More...
#include <ParamSerializers.h>
Inherits IParamSerializer< T >, and IDiscreteConverter< T >.
Public Types | |
using | ConstructorType = std::initializer_list< std::pair< const T, std::string > > const & |
Defines the type for the constructor argument. More... | |
using | ParamType = T |
using | TList = std::vector< T > |
Defines the mapping: discrete value [0, stepCount] to T. More... | |
using | TMap = std::map< T, std::pair< std::string, int32 >, Compare > |
Maintains the map of possible values of T (defined in constructor) More... | |
Public Types inherited from IParamSerializer< T > | |
using | ParamType = T |
Public Member Functions | |
tresult | convertFromDiscreteValue (int32 iDiscreteValue, ParamType &oValue) const override |
tresult | convertToDiscreteValue (ParamType const &iValue, int32 &oDiscreteValue) const override |
DiscreteTypeParamSerializer (ConstructorType iInitList) | |
int32 | getStepCount () const override |
tresult | readFromStream (IBStreamer &iStreamer, ParamType &oValue) const override |
tresult | writeToStream (const ParamType &iValue, IBStreamer &oStreamer) const override |
void | writeToStream (ParamType const &iValue, std::ostream &oStream) const override |
By default, this implementation simply writes the value to the stream IF it is possible (determined at compilation time). More... | |
Public Member Functions inherited from IParamSerializer< T > | |
virtual std::string | toString (ParamType const &iValue, int32 iPrecision) const |
Private Attributes | |
TList | fList {} |
TMap | fMap {} |
This converters maps a list of values of type T
to discrete values.
It can be used with any T
that is comparable (note that you can optionally provide your own Compare
). For example, T
can be an enum, enum class, struct, class, etc...
Example:
using ConstructorType = std::initializer_list<std::pair<const T, std::string> > const & |
Defines the type for the constructor argument.
Example: { { t, "abc" }, ... }
using ParamType = T |
using TList = std::vector<T> |
Defines the mapping: discrete value [0, stepCount] to T.
using TMap = std::map<T, std::pair<std::string, int32>, Compare> |
Maintains the map of possible values of T (defined in constructor)
|
inline |
|
inlineoverridevirtual |
Implements IDiscreteConverter< T >.
|
inlineoverridevirtual |
Implements IDiscreteConverter< T >.
|
inlineoverridevirtual |
Implements IDiscreteConverter< T >.
|
inlineoverridevirtual |
Implements IParamSerializer< T >.
|
inlineoverridevirtual |
Implements IParamSerializer< T >.
|
inlineoverridevirtual |
By default, this implementation simply writes the value to the stream IF it is possible (determined at compilation time).
Doesn't do anything if not. Subclasses can redefine this behavior.
Reimplemented from IParamSerializer< T >.
|
private |
|
private |