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

# ValueTypeManager Class Reference

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

Keeps track of all unique ValueTypes. Required to create new [ValueType](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md) shared resource instances. Script example:

## Get the [ValueTypeManager](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type_manager.md) associated with a database's [DataObjectContainer](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_data_object_container.md).

value\_type\_manager = sos.database().data().valueTypeManager()

## Create a floating point [ValueType](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md), without any attributes

value\_type = sos.ValueTypeDouble.create(value\_type\_manager, "my\_unique\_value\_type") \
&#x20;print("Created ValueType:") print(value\_type)

## Set attribute

value\_type.setAttribute("max", 10)

## Get Attribute

max = value\_type.attribute("max") print("Number of ValueTypes stored at ValueTypeManager:") print(value\_type\_manager.size()) #1 value\_type = None #Clear unreferenced ValueTypes value\_type\_manager.clearUnused() print("Number of ValueTypes stored at ValueTypeManager:") print(value\_type\_manager.size()) #0.

## Public Member Functions

| Type | Name |
| - | - |
| std::shared\_ptr\< [ValueType](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md) > | [add](#ad5980bb9b90886f3eb9f1bd3c6bf8c91) (std::shared\_ptr\< [ValueType](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md) > value\_type) Add a [ValueType](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md) shared resource. If an equal [ValueType](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md) instance (as determined by the == operator) already exists, the existing instance is returned. |
| size\_t | [clearUnused](#a89c4dbac8bd1b1451d695ca81fbd3d64) () Removes all unused [ValueType](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md) instances. |
| [ValueTypeManager](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type_manager.md) | [operator=](#a60dc6bfde52dbe186fcd5b03ee9c8987) ([ValueTypeManager](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type_manager.md) manager) Assignment operator. |
| size\_t | [size](#a0b6b70701c46e22849f0f363861351cd) () Get the number of unique [ValueType](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md) instances. |
| | [ValueTypeManager](#a77088d3cfe0f24c2d195fc42732811f1) () Default constructor. |
| | [ValueTypeManager](#a5ed7064a8346fe206c12cfd8107158e3) ([ValueTypeManager](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type_manager.md) manager) Default destructor. |

## Detailed Description

Keeps track of all unique ValueTypes. Required to create new [ValueType](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md) shared resource instances. Script example:

## Get the [ValueTypeManager](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type_manager.md) associated with a database's [DataObjectContainer](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_data_object_container.md).

value\_type\_manager = sos.database().data().valueTypeManager()

## Create a floating point [ValueType](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md), without any attributes

value\_type = sos.ValueTypeDouble.create(value\_type\_manager, "my\_unique\_value\_type") \
&#x20;print("Created ValueType:") print(value\_type)

## Set attribute

value\_type.setAttribute("max", 10)

## Get Attribute

max = value\_type.attribute("max") print("Number of ValueTypes stored at ValueTypeManager:") print(value\_type\_manager.size()) #1 value\_type = None #Clear unreferenced ValueTypes value\_type\_manager.clearUnused() print("Number of ValueTypes stored at ValueTypeManager:") print(value\_type\_manager.size()) #0.

output: Created [ValueType](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md): my\_unique\_value\_type Number of ValueTypes stored at [ValueTypeManager](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type_manager.md): 1 Number of ValueTypes stored at [ValueTypeManager](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type_manager.md): 0

## Constructor & Destructor Documentation

### ValueTypeManager()

```cpp theme={null}
ValueTypeManager(ValueTypeManager manager)
```

Default destructor.

Copy constructor

**Parameters**

| Name | Description |
| - | - |
| manager | object to be copied. |

## Member Function Documentation

### add()

```cpp theme={null}
std::shared_ptr< ValueType > add(std::shared_ptr< ValueType > value_type)
```

Add a [ValueType](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md) shared resource. If an equal [ValueType](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md) instance (as determined by the == operator) already exists, the existing instance is returned.

**Exceptions**

| Name | Description |
| - | - |
| If | a different [ValueType](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md) with equal name already exists. |

### clearUnused()

```cpp theme={null}
size_t clearUnused()
```

Removes all unused [ValueType](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md) instances.

**Returns**

Returns the number of ValueTypes removed.

### operator=()

```cpp theme={null}
ValueTypeManager operator=(ValueTypeManager manager)
```

Assignment operator.

**Parameters**

| Name | Description |
| - | - |
| manager | object to be assigned |

**Returns**

Assigned [ValueTypeManager](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type_manager.md)

### size()

```cpp theme={null}
size_t size()
```

Get the number of unique [ValueType](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_value_type.md) instances.

**Returns**

number of unique value types.
