Skip to main content
Part of Data Identifies a set of values as an enumration of strings type and an associated set of optional attributes (for instance minimum and maximum value). It provides conversion routines between floating point and string representation.

Public Types

Public Member Functions

Static Public Member Functions

Detailed Description

Identifies a set of values as an enumration of strings type and an associated set of optional attributes (for instance minimum and maximum value). It provides conversion routines between floating point and string representation. See also ValueTypeManager for Script example usage.
Constructor is private, use the create() method to create new instances as a shared resource.class ValueTypeEnum : public ValueType

Member Function Documentation

__str__()

inherited Function to allow printing instances of this class in python. Returns The unique name of this ValueType

attribute() [1/2]

inherited Returns the value of the given attribute. An attribute is a named value, to specify the behavior of the ValueType. For instance min/max. See ValueType derived classes for documentation of available attributes. Parameters Exceptions

attribute() [2/2]

inherited Returns the value of the given attribute. Default value is returned if the attribute is undefined. An attribute is a named value, to specify the behavior of the ValueType. For instance min/max. See ValueType derived classes for documentation of available attributes. Parameters

create()

static Default destructor. Create a new instances as a shared resources, which is stored at the ValueTypeManager. Static method, access in script: value_type = sos.ValueTypeDouble.create(manager, [“glass”, “wood”, “concrete”], “my_number_value_type”) Sets the “min” attribute to 0 Sets the “max” attribute to (number of unique strings - 1) Parameters Returns Shared resource of ValueType base class.

eraseAttribute()

inherited Removes an attribute. Parameters Returns True if the attribute was removed. False if the attribute was undefined.

setAttribute()

inherited Define an attribute. Existing attributes are overwritten. Parameters

toDouble()

override virtual Convert string to floating point value Enumeration [“glass”, “wood”, “concrete”]: “glass” -> 0.0 “wood” -> 1.0 “concrete” -> 2.0. Parameters Returns The converted value Exceptions Implements ValueType.

toString()

override virtual Convert number value to its string representation Enumeration [“glass”, “wood”, “concrete”]: 0.0 -> “glass” -> 0.0 1.0 -> “wood” 2.0 -> “concrete” Always returns “glass” if value <= 0 Always returns “concrete” if value >= 2 Value is floored ( 0.6 -> “glass”). Parameters Returns The string representation of the converted value Implements ValueType.