RTC Toolkit 5.1.0
Loading...
Searching...
No Matches
Public Types | Static Public Member Functions | Static Public Attributes | List of all members
rtctk::componentFramework::detail::UserTypeHandler< T > Struct Template Reference

Public Types

using BufferType = T
 Defines the type of the buffer object that handles type T.
 
using ElementType = std::remove_cv_t<T>
 Defines the element type of the buffer object.
 
using DataPointType = T
 Defines the corresponding data point type that type T is compatible with.
 
using TempBufferType = void
 Defines the temporary buffer type (set to void if USES_TEMP_BUFFER is false).
 

Static Public Member Functions

static RtcVectorUInt64 GetShape (const BufferType &buffer)
 Returns the shape of a buffer object.
 
static gsl::span< ElementTypeMakeSpan (BufferType &buffer)
 Creates a span from a buffer object.
 
static gsl::span< const ElementTypeMakeSpan (const BufferType &buffer)
 Creates a span from a read-only buffer object.
 
static bool ResizeBuffer (BufferType &buffer, const RtcVectorUInt64 &shape)
 Tries to resize the buffer to the given shape.
 
static void CopyToTempBuffer (const BufferType &buffer, std::shared_ptr< TempBufferType > &temp_buffer, size_t offset, size_t count)=delete
 Copy data from the original buffer into the temporary buffer.
 
static void CopyFromTempBuffer (BufferType &buffer, const std::shared_ptr< TempBufferType > &temp_buffer, size_t offset, size_t count)=delete
 Copy data from the temporary buffer into the original buffer.
 

Static Public Attributes

static const bool USES_TEMP_BUFFER = false
 Flag indicating if a temporary buffer is required to read/write this type.
 

Member Typedef Documentation

◆ BufferType

Defines the type of the buffer object that handles type T.

◆ DataPointType

Defines the corresponding data point type that type T is compatible with.

◆ ElementType

template<typename T >
using rtctk::componentFramework::detail::UserTypeHandler< T >::ElementType = std::remove_cv_t<T>

Defines the element type of the buffer object.

◆ TempBufferType

Defines the temporary buffer type (set to void if USES_TEMP_BUFFER is false).

Member Function Documentation

◆ CopyFromTempBuffer()

template<typename T >
static void rtctk::componentFramework::detail::UserTypeHandler< T >::CopyFromTempBuffer ( BufferType & buffer,
const std::shared_ptr< TempBufferType > & temp_buffer,
size_t offset,
size_t count )
staticdelete

Copy data from the temporary buffer into the original buffer.

This method must only be implemented if USES_TEMP_BUFFER is true, i.e for types that require temporary buffers.

Note
The buffers are treated as flat arrays.
Parameters
[out]bufferThe buffer object to copy the data into.
[in]temp_bufferThe temporary buffer object from which to copy the data.
[in]offsetThe index of the first element in buffer that will be written to.
[in]countThe number of elements to copy.

◆ CopyToTempBuffer()

template<typename T >
static void rtctk::componentFramework::detail::UserTypeHandler< T >::CopyToTempBuffer ( const BufferType & buffer,
std::shared_ptr< TempBufferType > & temp_buffer,
size_t offset,
size_t count )
staticdelete

Copy data from the original buffer into the temporary buffer.

This method must only be implemented if USES_TEMP_BUFFER is true, i.e for types that require temporary buffers.

Note
The buffers are treated as flat arrays.
Parameters
[in]bufferThe buffer object from which to copy the data.
[out]temp_bufferThe temporary buffer object to copy data into.
[in]offsetThe index of the first element in buffer to start copying.
[in]countThe number of elements to copy.

◆ GetShape()

Returns the shape of a buffer object.

Parameters
[in]bufferThe buffer object for which the shape is calculated.
Returns
A list of unsigned integers indicating the number of elements for each dimension. The size of the list must equal the number of dimensions, i.e. the rank. For example, a scalar will have zero entries, a vector one entry, a matrix two.

◆ MakeSpan() [1/2]

template<typename T >
static gsl::span< ElementType > rtctk::componentFramework::detail::UserTypeHandler< T >::MakeSpan ( BufferType & buffer)
inlinestatic

Creates a span from a buffer object.

Parameters
[in]bufferThe buffer object from which to create the span.
Returns
A span object accessing the buffer object's underlying elements.

◆ MakeSpan() [2/2]

template<typename T >
static gsl::span< const ElementType > rtctk::componentFramework::detail::UserTypeHandler< T >::MakeSpan ( const BufferType & buffer)
inlinestatic

Creates a span from a read-only buffer object.

Parameters
[in]bufferThe buffer object from which to create the span.
Returns
A span object accessing the buffer object's underlying elements.

◆ ResizeBuffer()

template<typename T >
static bool rtctk::componentFramework::detail::UserTypeHandler< T >::ResizeBuffer ( BufferType & buffer,
const RtcVectorUInt64 & shape )
inlinestatic

Tries to resize the buffer to the given shape.

If possible, the buffer should be resized to contain enough space to hold the total number of elements indicated by the shape. If it is not possible to resize to the space required, then no resize should occur and false should be returned. In the case the buffer is already the correct size, resizing can be skipped and true returned, to indicate the buffer is OK.

Parameters
[in,out]bufferThe buffer object to be resized.
[in]shapeThe shape the buffer should be resized to.
Returns
true if the buffer size is correct or could be resized, and false otherwise.

Member Data Documentation

◆ USES_TEMP_BUFFER

template<typename T >
const bool rtctk::componentFramework::detail::UserTypeHandler< T >::USES_TEMP_BUFFER = false
static

Flag indicating if a temporary buffer is required to read/write this type.


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