A DataObject is a self-contained value that holds the properties described by a DataType, addressed through DataPropertyPath.
More...
#include <luciad/datamodels/DataObject.h>
|
| Builder | asBuilder () const |
| | Returns this DataObject as a Builder, making it possible to copy and modify its values.
|
| const DataType & | getDataType () const |
| | Returns the data type describing this DataObject's properties.
|
| std::optional< size_t > | getListSize (const DataPropertyPath &propertyPath) const |
| | Returns the element count of a list-typed property.
|
| std::optional< size_t > | getListSize (const std::string &propertyName) const |
| | Convenience overload of getListSize that resolves the property by name on this data object's data type.
|
| template<typename T> |
| std::optional< T > | getValue (const DataPropertyPath &propertyPath) const |
| | Accesses the value for the given property.
|
| template<typename T> |
| std::optional< T > | getValue (const std::string &propertyName) const |
| | Convenience overload of getValue that resolves the property by name on this data object's data type.
|
| bool | operator!= (const DataObject &other) const |
| bool | operator== (const DataObject &other) const |
| | Returns whether this DataObject and the given DataObject are the same instance.
|
A DataObject is a self-contained value that holds the properties described by a DataType, addressed through DataPropertyPath.
DataObjects are immutable and thread-safe for reading. Use DataObject::Builder to create or modify one.
- Since
- 2026.1
◆ asBuilder()
| Builder luciad::DataObject::asBuilder |
( |
| ) |
const |
Returns this DataObject as a Builder, making it possible to copy and modify its values.
The data type cannot be changed through the returned builder.
- Returns
- this DataObject as a Builder.
◆ getDataType()
| const DataType & luciad::DataObject::getDataType |
( |
| ) |
const |
Returns the data type describing this DataObject's properties.
- Returns
- the data type describing this DataObject's properties.
◆ getListSize() [1/2]
| std::optional< size_t > luciad::DataObject::getListSize |
( |
const DataPropertyPath & | propertyPath | ) |
const |
Returns the element count of a list-typed property.
- Parameters
-
| propertyPath | the path to the list-typed property. |
- Returns
- no value if the list is unset, or the element count otherwise (0 for an empty list).
- Exceptions
-
◆ getListSize() [2/2]
| std::optional< size_t > luciad::DataObject::getListSize |
( |
const std::string & | propertyName | ) |
const |
Convenience overload of getListSize that resolves the property by name on this data object's data type.
Equivalent to calling getListSize with a DataPropertyPath built from getDataType() and propertyName.
Performance note: this overload resolves the name on every call. To read the same property from many data objects in a tight loop, build a DataPropertyPath once and use the DataPropertyPath overload, which prevents the repeated lookup.
- Parameters
-
| propertyName | the name of a list-typed property in this data object's data type. |
- Returns
- no value if the list is unset, or the element count otherwise (0 for an empty list).
- Exceptions
-
- Since
- 2026.1
◆ getValue() [1/2]
template<typename T>
| std::optional< T > luciad::DataObject::getValue |
( |
const DataPropertyPath & | propertyPath | ) |
const |
Accesses the value for the given property.
The type parameter T depends on the type of value this property contains:
- Scalar property: T is the element type (bool, int32_t, int64_t, float, double, std::string, or a Geometry, or one of its subtypes).
- Composite property (value type is a non-primitive DataType): T is luciad::DataObject, and the nested composite value is returned.
- List property: T is the list type, and the list is returned, or no value when the list is unset.
- List element: T is the element type (luciad::DataObject for a composite element), and the single element is returned.
- Template Parameters
-
| T | the value type, chosen by property shape (see above). |
- Parameters
-
| propertyPath | the property for which to return a value. |
- Returns
- the value, or no value if the property exists but is unset.
- Exceptions
-
| InvalidArgumentException | when the path does not match this DataObject's data type, T does not match the path's leaf type, or the list is unset or the index is out-of-bounds for an indexed path. |
◆ getValue() [2/2]
template<typename T>
| std::optional< T > luciad::DataObject::getValue |
( |
const std::string & | propertyName | ) |
const |
Convenience overload of getValue that resolves the property by name on this data object's data type.
Equivalent to calling getValue with a DataPropertyPath built from getDataType() and propertyName.
Performance note: this overload resolves the name on every call. To read the same property from many data objects in a tight loop, build a DataPropertyPath once and use the DataPropertyPath overload, which prevents the repeated lookup.
- Template Parameters
-
| T | the value type, chosen by the property's shape (see the DataPropertyPath overload). |
- Parameters
-
| propertyName | the name of a property in this data object's data type. |
- Returns
- the value, or no value if the property exists but is not set.
- Exceptions
-
- Since
- 2026.1
◆ newBuilder()
| Builder luciad::DataObject::newBuilder |
( |
| ) |
|
|
static |
◆ operator!=()
| bool luciad::DataObject::operator!= |
( |
const DataObject & | other | ) |
const |
◆ operator==()
| bool luciad::DataObject::operator== |
( |
const DataObject & | other | ) |
const |