ValueType Class Reference
Last update: 16.07.2025Represents a type of value and a set of properties. ValueType is intended to be associated with a set of floating point data values. It stores information (the value type and named value attributes) about data values. It provides conversion routines between its associated floating point data values and value type. More...
Public Types | |
| enum | eType { DOUBLE = 1, INT = 2, BOOL = 3, ENUM = 4 } |
| Enumeration of all available value types. Returned by type() method. Used to identify from which derived class the shared base class ValueType object has been created. | |
Public Member Functions | |
| string | __str__ () |
| Function to allow printing instances of this class in python. More... | |
| number | attribute (string attribute) |
| 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. More... | |
| number | attribute (string attribute, number default_value) |
| 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. More... | |
| bool | attributeExists (string attribute) |
| Check whether an attribute is defined. | |
| string | description () |
| Get the description of this ValueType. | |
| bool | eraseAttribute (string attribute) |
| Removes an attribute. More... | |
| string | name () |
| Get the unique name of this ValueType. | |
| bool | operator!= (ValueType b) |
| Returns false if both types have equal name, value type, attributes and description. | |
| bool | operator== (ValueType b) |
| Returns true if both types have equal name, value type, attributes and description. | |
| bool | operator> (ValueType b) |
| Sort by name. | |
| setAttribute (string attribute, number value) | |
| Define an attribute. Existing attributes are overwritten. More... | |
| virtual number | toDouble (string str)=0 |
| Convert a string to number precision floating point value. More... | |
| virtual string | toString (number value)=0 |
| Convert a string to number precision floating point value. More... | |
| eType | type () |
| Get the Type of this ValueType. | |
Detailed Description
Represents a type of value and a set of properties. ValueType is intended to be associated with a set of floating point data values. It stores information (the value type and named value attributes) about data values. It provides conversion routines between its associated floating point data values and value type.
- See also
- ValueTypeManager for Script example usage.
- Note
- Constructor is private. Use create() method of derived classes (ValueTypeDouble, ValueTypeDouble, ValueTypeBool, ValueTypeEnum).
Member Function Documentation
◆ __str__()
| string __str__ | ( | ) |
Function to allow printing instances of this class in python.
- Returns
- The unique name of this ValueType
◆ attribute() [1/2]
| number attribute | ( | string | attribute | ) |
◆ attribute() [2/2]
| number attribute | ( | string | attribute, |
| number | default_value | ||
| ) |
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
-
attribute Attribute to search for. default_value Value returned if attribute is undefined.
◆ eraseAttribute()
| bool eraseAttribute | ( | string | attribute | ) |
Removes an attribute.
- Parameters
-
attribute The attribute to remove
- Returns
- True if the attribute was removed. False if the attribute was undefined.
◆ setAttribute()
| setAttribute | ( | string | attribute, |
| number | value | ||
| ) |
Define an attribute. Existing attributes are overwritten.
- Parameters
-
attribute Name of the attribute. value Value of the attribute.
◆ toDouble()
|
pure virtual |
Convert a string to number precision floating point value.
- See also
- Derived classes for type specific implementation
- Parameters
-
str The string to convert
- Returns
- The converted value
Implemented in ValueTypeEnum, ValueTypeBool, ValueTypeDouble, and ValueTypeInt.
◆ toString()
|
pure virtual |
Convert a string to number precision floating point value.
- See also
- Derived classes for type specific implementation
- Parameters
-
str The string to convert
- Returns
- The converted value
Implemented in ValueTypeEnum, ValueTypeBool, ValueTypeInt, and ValueTypeDouble.