XII Release 0.1.0
Loading...
Searching...
No Matches
xiiBlobPtr< 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 xiiArrayPtrDetail::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

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

Detailed Description

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

Member Function Documentation

◆ GetSubArray()

template<typename T>
XII_FORCE_INLINE xiiBlobPtr< T > xiiBlobPtr< T >::GetSubArray ( xiiUInt64 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: