cesium-native 0.43.0
Loading...
Searching...
No Matches
CesiumGltf::AccessorWriter< T > Class Template Referencefinal

Provides write access to an AccessorView. More...

#include <CesiumGltf/AccessorWriter.h>

Public Types

typedef T value_type
 The type of the elements in the accessor.
 

Public Member Functions

 AccessorWriter (const AccessorView< T > &accessorView)
 Constructs a new instance from an AccessorView.
 
 AccessorWriter (std::byte *pData, int64_t stride, int64_t offset, int64_t size)
 Creates a new instance from low-level parameters.
 
 AccessorWriter (Model &model, const Accessor &accessor)
 Creates a new instance from a given model and Accessor.
 
 AccessorWriter (Model &model, int32_t accessorIndex) noexcept
 Creates a new instance from a given model and accessor index.
 
const T & operator[] (int64_t i) const
 Provides the specified accessor element.
 
T & operator[] (int64_t i)
 Provides the specified accessor element.
 
int64_t size () const noexcept
 Returns the size (number of elements) of this accessor.
 
AccessorViewStatus status () const noexcept
 Gets the status of this accessor writer.
 
int64_t stride () const noexcept
 Returns the stride of this accessor, which is the number of bytes from the start of one element to the start of the next.
 
int64_t offset () const noexcept
 Returns the offset of this accessor, which is the number of bytes from the start of the buffer to the first element.
 
std::byte * data () noexcept
 Returns a pointer to the first byte of this accessor view's data. The elements are stored contiguously, so the next one starts stride bytes later.
 

Detailed Description

template<class T>
class CesiumGltf::AccessorWriter< T >

Provides write access to an AccessorView.

Definition at line 10 of file AccessorWriter.h.

Member Typedef Documentation

◆ value_type

template<class T >
T CesiumGltf::AccessorWriter< T >::value_type

The type of the elements in the accessor.

Definition at line 18 of file AccessorWriter.h.

Constructor & Destructor Documentation

◆ AccessorWriter() [1/5]

template<class T >
CesiumGltf::AccessorWriter< T >::AccessorWriter ( )
inline

Definition at line 20 of file AccessorWriter.h.

◆ AccessorWriter() [2/5]

template<class T >
CesiumGltf::AccessorWriter< T >::AccessorWriter ( const AccessorView< T > & accessorView)
inline

Constructs a new instance from an AccessorView.

Definition at line 25 of file AccessorWriter.h.

◆ AccessorWriter() [3/5]

template<class T >
CesiumGltf::AccessorWriter< T >::AccessorWriter ( std::byte * pData,
int64_t stride,
int64_t offset,
int64_t size )
inline

Creates a new instance from low-level parameters.

The provided parameters are not validated in any way, and so this overload can easily be used to access invalid memory.

Parameters
pDataThe raw data buffer from which to read.
strideThe stride, in bytes, between successive elements.
offsetThe offset from the start of the buffer to the first element.
sizeThe total number of elements.

Definition at line 30 of file AccessorWriter.h.

◆ AccessorWriter() [4/5]

template<class T >
CesiumGltf::AccessorWriter< T >::AccessorWriter ( Model & model,
const Accessor & accessor )
inline

Creates a new instance from a given model and Accessor.

If the accessor cannot be viewed, the construct will still complete successfully without throwing an exception. However, size will return 0 and status will indicate what went wrong.

Parameters
modelThe model to access.
accessorThe accessor to view.

Definition at line 34 of file AccessorWriter.h.

◆ AccessorWriter() [5/5]

template<class T >
CesiumGltf::AccessorWriter< T >::AccessorWriter ( Model & model,
int32_t accessorIndex )
inlinenoexcept

Creates a new instance from a given model and accessor index.

If the accessor cannot be viewed, the construct will still complete successfully without throwing an exception. However, size will return 0 and status will indicate what went wrong.

Parameters
modelThe model to access.
accessorIndexThe index of the accessor to view in the model's Model::accessors list.

Definition at line 38 of file AccessorWriter.h.

Member Function Documentation

◆ data()

template<class T >
std::byte * CesiumGltf::AccessorWriter< T >::data ( )
inlinenoexcept

Returns a pointer to the first byte of this accessor view's data. The elements are stored contiguously, so the next one starts stride bytes later.

Returns
The start of this view.

Definition at line 67 of file AccessorWriter.h.

◆ offset()

template<class T >
int64_t CesiumGltf::AccessorWriter< T >::offset ( ) const
inlinenoexcept

Returns the offset of this accessor, which is the number of bytes from the start of the buffer to the first element.

Returns
The offset.

Definition at line 64 of file AccessorWriter.h.

◆ operator[]() [1/2]

template<class T >
T & CesiumGltf::AccessorWriter< T >::operator[] ( int64_t i)
inline

Provides the specified accessor element.

Parameters
iThe index of the element.
Returns
The constant reference to the accessor element.
Exceptions
Astd::range_error if the given index is negative or not smaller than the size of this accessor.

Definition at line 45 of file AccessorWriter.h.

◆ operator[]() [2/2]

template<class T >
const T & CesiumGltf::AccessorWriter< T >::operator[] ( int64_t i) const
inline

Provides the specified accessor element.

Parameters
iThe index of the element.
Returns
The constant reference to the accessor element.
Exceptions
Astd::range_error if the given index is negative or not smaller than the size of this accessor.

Definition at line 42 of file AccessorWriter.h.

◆ size()

template<class T >
int64_t CesiumGltf::AccessorWriter< T >::size ( ) const
inlinenoexcept

Returns the size (number of elements) of this accessor.

This is the number of elements of type T that this accessor contains.

Returns
The size.

Definition at line 48 of file AccessorWriter.h.

◆ status()

template<class T >
AccessorViewStatus CesiumGltf::AccessorWriter< T >::status ( ) const
inlinenoexcept

Gets the status of this accessor writer.

Indicates whether the writer accurately reflects the accessor's data, or whether an error occurred.

Definition at line 56 of file AccessorWriter.h.

◆ stride()

template<class T >
int64_t CesiumGltf::AccessorWriter< T >::stride ( ) const
inlinenoexcept

Returns the stride of this accessor, which is the number of bytes from the start of one element to the start of the next.

Returns
The stride.

Definition at line 61 of file AccessorWriter.h.


The documentation for this class was generated from the following file: