Plasma Engine  2.0
Loading...
Searching...
No Matches
plBlobPtr< 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 plArrayPtrDetail::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

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

Detailed Description

template<typename T>
class plBlobPtr< 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 plBlobPtr only allows for easier access.

Member Function Documentation

◆ GetSubArray()

template<typename T >
PL_FORCE_INLINE plBlobPtr< T > plBlobPtr< T >::GetSubArray ( plUInt64 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: