> ## 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.

# ValueType Class Reference

Part of [Data](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/group__data)

Represents a type of value and a set of properties. [ValueType](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md) 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.

## Public Types

| Type | Name |
| - | - |
| enum | [eType](#a12f8ec8f0e7a4584b9fe481bb53fa60e) \{ **DOUBLE** = 1, **INT** = 2, **BOOL** = 3, **ENUM** = 4 } Enumeration of all available value types. Returned by [type()](#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\_\_](#a44139caf93a3463ea4f2a6671cdce842) () Function to allow printing instances of this class in python. |
| number | [attribute](#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](#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](#abc6417bd7b50620ce73098bd5859540d) (string [attribute](#a4fe78fe23647b841774a467f7115e242)) Check whether an attribute is defined. |
|  string | [description](#a166e44f3030115668a91a35ffb81ff11) () Get the description of this [ValueType](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md). |
| bool | [eraseAttribute](#a39693bcee84d3daf689384219bd7e89c) (string [attribute](#a4fe78fe23647b841774a467f7115e242)) Removes an attribute. |
|  string | [name](#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!=](#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==](#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>](#a3355fe903707accf684bf8ca5dd30f34) ([ValueType](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md) b) Sort by name. |
| | [setAttribute](#a8bdd98028a4fcad8345fb72becb3c0d4) (string [attribute](#a4fe78fe23647b841774a467f7115e242), number value) Define an attribute. Existing attributes are overwritten. |
| virtual number | [toDouble](#a0f53106b13e55a9126710549e5d91fd0) (string str)=0 Convert a string to number precision floating point value. |
| virtual string | [toString](#ac64491e7d149ef1fdb6bc14df52a27d1) (number value)=0 Convert a string to number precision floating point value. |
| [eType](#a12f8ec8f0e7a4584b9fe481bb53fa60e) | [type](#a04b0a9497332985d1c7386b487924e85) () Get the Type of this [ValueType](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md). |

## Detailed Description

Represents a type of value and a set of properties. [ValueType](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md) 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](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 create() method of derived classes ([ValueTypeDouble](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type_double.md), [ValueTypeDouble](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type_double.md), [ValueTypeBool](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type_bool.md), [ValueTypeEnum](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type_enum.md)).

## Member Function Documentation

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

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

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

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

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. |

### eraseAttribute()

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

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

Define an attribute. Existing attributes are overwritten.

**Parameters**

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

### toDouble()

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

`pure virtual`

Convert a string to number precision floating point value.

**See also**

Derived classes for [type](#a04b0a9497332985d1c7386b487924e85) specific implementation

**Parameters**

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

**Returns**

The converted value

Implemented in [ValueTypeEnum](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type_enum.md#a3feb53908f4c019f35111daf04a190b8), [ValueTypeBool](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type_bool.md#a3feb53908f4c019f35111daf04a190b8), [ValueTypeDouble](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type_double.md#a3feb53908f4c019f35111daf04a190b8), and [ValueTypeInt](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type_int.md#a3feb53908f4c019f35111daf04a190b8).

### toString()

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

`pure virtual`

Convert a string to number precision floating point value.

**See also**

Derived classes for [type](#a04b0a9497332985d1c7386b487924e85) specific implementation

**Parameters**

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

**Returns**

The converted value

Implemented in [ValueTypeEnum](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type_enum.md#afe98eed581fb1712f5b265fcce59dfda), [ValueTypeBool](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type_bool.md#afe98eed581fb1712f5b265fcce59dfda), [ValueTypeInt](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type_int.md#afe98eed581fb1712f5b265fcce59dfda), and [ValueTypeDouble](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type_double.md#afe98eed581fb1712f5b265fcce59dfda).
