> ## Documentation Index
> Fetch the complete documentation index at: https://developer.synopsys.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ValueTypeEnum Class Reference

Part of [Data](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/group__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

| Type | Name |
| - | - |
| enum | [eType](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md#a12f8ec8f0e7a4584b9fe481bb53fa60e) \{ **DOUBLE** = 1, **INT** = 2, **BOOL** = 3, **ENUM** = 4 } Enumeration of all available value types. Returned by [type()](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md#a04b0a9497332985d1c7386b487924e85) method. Used to identify from which derived class the shared base class [ValueType](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md) object has been created. |

## Public Member Functions

| Type | Name |
| - | - |
| string | [\_\_str\_\_](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md#a44139caf93a3463ea4f2a6671cdce842) () Function to allow printing instances of this class in python. |
| number | [attribute](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md#a4fe78fe23647b841774a467f7115e242) (string attribute) Returns the value of the given attribute. An attribute is a named value, to specify the behavior of the [ValueType](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md). For instance min/max. See [ValueType](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md) derived classes for documentation of available attributes. |
| number | [attribute](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md#a945190dbb867b410997fa2d77a1a629f) (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](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md). For instance min/max. See [ValueType](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md) derived classes for documentation of available attributes. |
|  bool | [attributeExists](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md#abc6417bd7b50620ce73098bd5859540d) (string [attribute](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md#a4fe78fe23647b841774a467f7115e242)) Check whether an attribute is defined. |
|  string | [description](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md#a166e44f3030115668a91a35ffb81ff11) () Get the description of this [ValueType](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md). |
| bool | [eraseAttribute](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md#a39693bcee84d3daf689384219bd7e89c) (string [attribute](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md#a4fe78fe23647b841774a467f7115e242)) Removes an attribute. |
|  string | [name](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md#aa62b508d2c0e7d9cec12924965276eb5) () Get the unique name of this [ValueType](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md). |
|  bool | [operator!=](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md#a7fe700521405d7e9ecb39f9c20eb2589) ([ValueType](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md) b) Returns false if both types have equal name, value type, attributes and description. |
|  bool | [operator==](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md#a99b4ecb5a908b5fb78fddad314091737) ([ValueType](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md) b) Returns true if both types have equal name, value type, attributes and description. |
|  bool | [operator>](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md#a3355fe903707accf684bf8ca5dd30f34) ([ValueType](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md) b) Sort by name. |
| | [setAttribute](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md#a8bdd98028a4fcad8345fb72becb3c0d4) (string [attribute](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md#a4fe78fe23647b841774a467f7115e242), number value) Define an attribute. Existing attributes are overwritten. |
| number | [toDouble](#a3feb53908f4c019f35111daf04a190b8) (string str) override Convert string to floating point value Enumeration \["glass", "wood", "concrete"]: "glass" -> 0.0 "wood" -> 1.0 "concrete" -> 2.0. |
| string | [toString](#afe98eed581fb1712f5b265fcce59dfda) (number value) override 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"). |
| [eType](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md#a12f8ec8f0e7a4584b9fe481bb53fa60e) | [type](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md#a04b0a9497332985d1c7386b487924e85) () Get the Type of this [ValueType](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md). |

## Static Public Member Functions

| Type | Name |
| - | - |
| static std::shared\_ptr\< [ValueType](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md) > | [create](#a5759d5b685b07907b22bba0d257f1488) ([ValueTypeManager](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type_manager.md) manager, string [name](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md#aa62b508d2c0e7d9cec12924965276eb5), std::vector\< string > strings, string [description](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md#a166e44f3030115668a91a35ffb81ff11)="Enumeration of strings type.") Default destructor. |

## 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](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type_manager.md) for [Script](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/group__script) example usage.

> [!NOTE]
>
> Constructor is private, use the [create()](#a5759d5b685b07907b22bba0d257f1488) method to create new instances as a shared resource.class [ValueTypeEnum](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type_enum.md) : public [ValueType](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md)

## Member Function Documentation

### \_\_str\_\_()

```cpp theme={null}
string __str__()
```

`inherited`

Function to allow printing instances of this class in python.

**Returns**

The unique name of this [ValueType](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md)

### attribute() \[1/2]

```cpp theme={null}
number attribute(string attribute)
```

`inherited`

Returns the value of the given attribute. An attribute is a named value, to specify the behavior of the [ValueType](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md). For instance min/max. See [ValueType](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md) derived classes for documentation of available attributes.

**Parameters**

| Name | Description |
| - | - |
| attribute | Attribute to search for |

**Exceptions**

| Name | Description |
| - | - |
| If | attribute is undefined |

### attribute() \[2/2]

```cpp theme={null}
number attribute(
    string attribute,
    number default_value
)
```

`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](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md). For instance min/max. See [ValueType](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md) derived classes for documentation of available attributes.

**Parameters**

| Name | Description |
| - | - |
| attribute | Attribute to search for. |
| default\_value | Value returned if attribute is undefined. |

### create()

```cpp theme={null}
static std::shared_ptr< ValueType > create(
    ValueTypeManager manager,
    string name,
    std::vector< string > strings,
    string description = "Enumeration of strings type."
)
```

`static`

Default destructor.

Create a new instances as a shared resources, which is stored at the [ValueTypeManager](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type_manager.md). 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**

| Name | Description |
| - | - |
| manager | [ValueTypeManager](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type_manager.md) where the shared resource is stored at. |
| name | Unique name of this [ValueType](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md). |
| strings | Vector of strings the enumeration type consists of. Duplicate strings are omitted. The order of strings remains unchanged. |
| description | \[optional] Short description string of this [ValueType](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md) |
| attributes | \[optional] Map of named number precision attributes |

**Returns**

Shared resource of [ValueType](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md) base class.

### eraseAttribute()

```cpp theme={null}
bool eraseAttribute(string attribute)
```

`inherited`

Removes an attribute.

**Parameters**

| Name | Description |
| - | - |
| attribute | The attribute to remove |

**Returns**

True if the attribute was removed. False if the attribute was undefined.

### setAttribute()

```cpp theme={null}
setAttribute(
    string attribute,
    number value
)
```

`inherited`

Define an attribute. Existing attributes are overwritten.

**Parameters**

| Name | Description |
| - | - |
| attribute | Name of the attribute. |
| value | Value of the attribute. |

### toDouble()

```cpp theme={null}
number toDouble(string str)
```

`override` `virtual`

Convert string to floating point value Enumeration \["glass", "wood", "concrete"]: "glass" -> 0.0 "wood" -> 1.0 "concrete" -> 2.0.

**Parameters**

| Name | Description |
| - | - |
| str | The string to convert |

**Returns**

The converted value

**Exceptions**

| Name | Description |
| - | - |
| if | the string is not part of this enumeration type. |

Implements [ValueType](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md#a0f53106b13e55a9126710549e5d91fd0).

### toString()

```cpp theme={null}
string toString(number value)
```

`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**

| Name | Description |
| - | - |
| value | the number value to convert |

**Returns**

The string representation of the converted value

Implements [ValueType](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md#ac64491e7d149ef1fdb6bc14df52a27d1).
