ezEngine  Release 25.03
ezBlobPtr< T > Class Template Reference

This class encapsulates a blob's storage and it's size. It is recommended to use this class instead of directly working on the void* of the blob. More...

#include <Blob.h>

Public Types

using ByteType = typename ezArrayPtrDetail::ByteTypeHelper< T >::type
 
using ValueType = T
 
using PointerType = T *
 
using const_iterator = const T *
 
using const_reverse_iterator = const_reverse_pointer_iterator< T >
 
using iterator = T *
 
using reverse_iterator = reverse_pointer_iterator< T >
 

Public Member Functions

 EZ_DECLARE_POD_TYPE ()
 
 ezBlobPtr ()=default
 Initializes the ezBlobPtr to be empty.
 
template<typename U >
 ezBlobPtr (U *pPtr, ezUInt64 uiCount)
 Initializes the ezBlobPtr with the given pointer and number of elements. No memory is allocated or copied.
 
template<size_t N>
EZ_ALWAYS_INLINE ezBlobPtr (ValueType(&staticArray)[N])
 Initializes the ezBlobPtr to encapsulate the given array.
 
EZ_ALWAYS_INLINE ezBlobPtr (const ezBlobPtr< T > &other)
 Initializes the ezBlobPtr to be a copy of other. No memory is allocated or copied.
 
EZ_ALWAYS_INLINE ezBlobPtr (const ezArrayPtr< T > &other)
 Initializes the ezBlobPtr to be a copy of other. No memory is allocated or copied.
 
 operator ezBlobPtr< const T > () const
 Convert to const version.
 
EZ_ALWAYS_INLINE void operator= (const ezBlobPtr< T > &other)
 Copies the pointer and size of /a other. Does not allocate any data.
 
EZ_ALWAYS_INLINE void operator= (const ezArrayPtr< T > &other)
 Copies the pointer and size of /a other. Does not allocate any data.
 
EZ_ALWAYS_INLINE void Clear ()
 Clears the array.
 
EZ_ALWAYS_INLINE void operator= (std::nullptr_t)
 
EZ_ALWAYS_INLINE PointerType GetPtr () const
 Returns the pointer to the array.
 
EZ_ALWAYS_INLINE PointerType GetPtr ()
 Returns the pointer to the array.
 
EZ_ALWAYS_INLINE PointerType GetEndPtr ()
 Returns the pointer behind the last element of the array.
 
EZ_ALWAYS_INLINE PointerType GetEndPtr () const
 Returns the pointer behind the last element of the array.
 
EZ_ALWAYS_INLINE bool IsEmpty () const
 Returns whether the array is empty.
 
EZ_ALWAYS_INLINE ezUInt64 GetCount () const
 Returns the number of elements in the array.
 
EZ_FORCE_INLINE ezBlobPtr< T > GetSubArray (ezUInt64 uiStart, ezUInt64 uiCount) const
 Creates a sub-array from this array.
 
EZ_FORCE_INLINE ezBlobPtr< T > GetSubArray (ezUInt64 uiStart) const
 Creates a sub-array from this array. More...
 
EZ_ALWAYS_INLINE ezBlobPtr< const ByteType > ToByteBlob () const
 Reinterprets this array as a byte array.
 
EZ_ALWAYS_INLINE ezBlobPtr< ByteType > ToByteBlob ()
 Reinterprets this array as a byte array.
 
template<typename U >
EZ_ALWAYS_INLINE ezBlobPtr< U > Cast ()
 Cast an BlobPtr to an BlobPtr to a different, but same size, type.
 
template<typename U >
EZ_ALWAYS_INLINE ezBlobPtr< const U > Cast () const
 Cast an BlobPtr to an BlobPtr to a different, but same size, type.
 
const EZ_FORCE_INLINE ValueType & operator[] (ezUInt64 uiIndex) const
 Index access.
 
EZ_FORCE_INLINE ValueType & operator[] (ezUInt64 uiIndex)
 Index access.
 
bool operator== (const ezBlobPtr< const T > &other) const
 Compares the two arrays for equality.
 
EZ_ALWAYS_INLINE bool operator!= (const ezBlobPtr< const T > &other) const
 Compares the two arrays for inequality.
 
void CopyFrom (const ezBlobPtr< const T > &other)
 Copies the data from other into this array. The arrays must have the exact same size.
 
EZ_ALWAYS_INLINE void Swap (ezBlobPtr< T > &other)
 

Detailed Description

template<typename T>
class ezBlobPtr< T >

This class encapsulates a blob's storage and it's size. It is recommended to use this class instead of directly working on the void* of the blob.

No data is deallocated at destruction, the ezBlobPtr only allows for easier access.

Member Function Documentation

◆ GetSubArray()

template<typename T >
EZ_FORCE_INLINE ezBlobPtr<T> ezBlobPtr< T >::GetSubArray ( ezUInt64  uiStart) const
inline

Creates a sub-array from this array.

Note
ap.GetSubArray(i)
is equivalent to
ap.GetSubArray(i, ap.GetCount() - i)
.

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