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

# ValueTypeInt Class Reference

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

Identifies a set of values as integer values 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. |
| string | [toString](#afe98eed581fb1712f5b265fcce59dfda) (number value) override Convert number value to its string representation Double value is casted to integer before conversion to string. 1.6 -> "1". |
| [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](#a7c45a9ee4344483e5a55e76d2442e70a) ([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), string [description](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md#a166e44f3030115668a91a35ffb81ff11)="Integer type.", std::map\< string, number > attributes=\{}) Default destructor. |

## Detailed Description

Identifies a set of values as integer values 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()](#a7c45a9ee4344483e5a55e76d2442e70a) method to create new instances as a shared resource.

## 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,
    string description = "Integer type.",
    std::map< string, number > attributes = {}
)
```

`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.ValueTypeInt.create(manager, "my\_int\_value\_type")

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

**Parameters**

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

**Returns**

The converted value

**Exceptions**

| Name | Description |
| - | - |
| if | conversion to number fails |

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 Double value is casted to integer before conversion to string. 1.6 -> "1".

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