ValueTypeManager Class Reference
Last update: 16.07.2025Keeps track of all unique ValueTypes. Required to create new ValueType shared resource instances. Script example:
Get the ValueTypeManager associated with a database's DataObjectContainer.
value_type_manager = sos.database().data().valueTypeManager()Create a floating point ValueType, without any attributes
value_type = sos.ValueTypeDouble.create(value_type_manager, "my_unique_value_type")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. More...Public Member Functions | |
| std::shared_ptr< ValueType > | add (std::shared_ptr< ValueType > value_type) |
| Add a ValueType shared resource. If an equal ValueType instance (as determined by the == operator) already exists, the existing instance is returned. More... | |
| size_t | clearUnused () |
| Removes all unused ValueType instances. More... | |
| ValueTypeManager | operator= (ValueTypeManager manager) |
| Assignment operator. More... | |
| size_t | size () |
| Get the number of unique ValueType instances. More... | |
| ValueTypeManager () | |
| Default constructor. | |
| ValueTypeManager (ValueTypeManager manager) | |
| Default destructor. More... | |
Detailed Description
Keeps track of all unique ValueTypes. Required to create new ValueType shared resource instances. Script example:
Get the ValueTypeManager associated with a database's DataObjectContainer.
value_type_manager = sos.database().data().valueTypeManager()
Create a floating point ValueType, without any attributes
value_type = sos.ValueTypeDouble.create(value_type_manager, "my_unique_value_type")
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: my_unique_value_type Number of ValueTypes stored at ValueTypeManager: 1 Number of ValueTypes stored at ValueTypeManager: 0
Constructor & Destructor Documentation
◆ ValueTypeManager()
| ValueTypeManager | ( | ValueTypeManager | manager | ) |
Default destructor.
Copy constructor
- Parameters
-
manager object to be copied.
Member Function Documentation
◆ add()
◆ clearUnused()
| size_t clearUnused | ( | ) |
Removes all unused ValueType instances.
- Returns
- Returns the number of ValueTypes removed.
◆ operator=()
| ValueTypeManager operator= | ( | ValueTypeManager | manager | ) |
◆ size()
| size_t size | ( | ) |
Get the number of unique ValueType instances.
- Returns
- number of unique value types.