omni::graph::core::ogn::array

Defined in omni/graph/core/ogn/array.h

Inheritance Relationships

Base Type

template<typename BaseDataType>
class array : public omni::graph::core::ogn::base_array<BaseDataType, AttributeDataHandle>

std::vector-like wrapper class for array attribute data in the Ogn Database.

It operates by using the Fabric interface to interact with array data it has stored. This non-const version of the array wrapper should be used for output attributes, whose data will be changed. (The naming is “array” for consistency with how attribute types are named, even though it doesn’t behave like a std::array, whose content size is determined at compile time.)

Template Parameters

BaseDataType – Type of data contained within the array

Public Types

using parent_t = base_array<BaseDataType, AttributeDataHandle>

The type of the parent class.

using iterator = typename gsl::span<BaseDataType>::iterator

Iterator over the array contents.

using reverse_iterator = typename gsl::span<BaseDataType>::reverse_iterator

Reverse iterator over the array contents.

using ConstBaseDataType = const typename std::remove_const<BaseDataType>::type

const version of the BaseDataType

using this_t = base_array<BaseDataType, AttributeDataHandle>

Type definition of this class.

Public Functions

array() = default

Constructor.

inline array &operator=(array<BaseDataType> const &rhs)

Assignment operator: performs a shallow copy.

Parameters

rhs[in] The array being copied in

Returns

Reference to this

inline array &operator=(const_array<const BaseDataType> const &rhs)

Assignment operator: performs a shallow copy of a const array of const data.

Parameters

rhs[in] The array being copied in

Returns

Reference to this

inline array &operator=(const_array<BaseDataType> const &rhs)

Assignment operator: performs a shallow copy of a const array of non-const data.

Parameters

rhs[in] The array being copied in

Returns

Reference to this

inline array &shallowCopy(const_array<BaseDataType> const &from)

Performs a shallow copy the provided object over this object.

This will create a reference for this object that points to the provided object

Parameters

from[in] The array being copied in

Returns

Reference to this

inline array &deepCopy(parent_t const &rhs)

Overwrite this object data with data from the provided object.

This will create a duplicate of all array members and reset the references

Parameters

rhs[in] The array being copied in

Returns

Reference to this

inline void resize(size_t newCount)

Set the size of the array data to a new value.

This may or may not relocate memory. If anything is holding a raw pointer from contents() that pointer should be refreshed by calling contents() again when this method returns.

Parameters

newCount[in] New element count of the array.

inline BaseDataType *data()
Returns

Non-const pointer to the raw data in the array (first element)

inline BaseDataType &operator[](size_t index)

Access a specific element of the array.

No bounds checking is performed.

Parameters

index[in] Element index into the array

Returns

Reference to the index’th element of the array

inline BaseDataType &at(size_t index)

Access a specific element of the array with bounds checking.

Parameters

index[in] Element index into the array

Throws

std::out_of_range – if there is no data for the given index

Returns

Reference to the index’th element of the array

inline bool isValid() const

Confirm that the data values are safe for accessing.

Returns

true if the context and attribute handle values are both valid

inline size_t size() const
Returns

The number of elements in the currently managed array

inline bool empty() const
Returns

Is the currently managed array empty?

inline ConstBaseDataType *data() const
Returns

Pointer to the raw data in the array (first element)

inline const iterator begin() const
Returns

Iterator pointing to the beginning of the array

inline const iterator end() const
Returns

Iterator pointing past the end of the array

inline const reverse_iterator rbegin() const
Returns

Iterator pointing to the end of the array

inline const reverse_iterator rend() const
Returns

Iterator pointing before the beginning of the array

inline ConstBaseDataType &operator[](size_t index) const

Access a specific element of the array.

No bounds checking is performed.

Parameters

index[in] Element index into the array

Returns

Reference to the index’th element of the array

inline ConstBaseDataType &at(size_t index) const

Access a specific element of the array with bounds checking.

Parameters

index[in] Element index into the array

Throws

std::out_of_range – if there is no data for the given index

Returns

Reference to the index’th element of the array

inline gsl::span<BaseDataType> const &span() const

Access the underlying span that allows to access the array data.

Returns

A reference to the underlying span

inline GraphContextObj const *context() const

Access the context to which this array belongs.

Returns

Pointer to the context to which this array belongs

inline AttributeDataHandle const &handle() const

Access the attribute handle used to access the array data in Fabric.

Returns

Pointer to the attribute handle used to access the array data in Fabric

inline void setDirty() const

Flag the span data as not being up2Date.

inline void adjustHandle(size_t idx)

In a vectorized context, move forward the current handle.

Parameters

idx[in] The amount of instance(s) to offset the current handle

Protected Functions

inline void reset()

Reset the internal span to point to new data.

inline BaseDataType **getData(const IAttributeData &iData, ConstAttributeDataHandle const &hdl)

Get a pointer to the array data from a specific const data handle.

Parameters
  • iData – Interface class containing the accessor functions

  • hdl – Handle to the attribute data whose value is being retrieved

Returns

BaseDataType** Pointer to the array of retrieved data

inline BaseDataType **getData(const IAttributeData &iData, AttributeDataHandle const &hdl)

Get a pointer to the array data from a specific mutable data handle.

Parameters
  • iData – Interface class containing the accessor functions

  • hdl – Handle to the attribute data whose value is being retrieved

Returns

BaseDataType** Pointer to the array of retrieved data

inline void setContext(const GraphContextObj &context)

Set the context.

This is done to allow the same wrapper class to be used for multiple evaluations in different contexts.

Parameters

context[in] The graph context to which the array belongs

inline void setHandle(AttributeDataHandle handle)

Set the attribute handle.

This is done to allow the same wrapper class to be used for multiple evaluations in different contexts.

Parameters

handle[in] Handle to the attribute to which the array belongs