template class Core::IO::Array
Overview
Template class for element-based buffers. More…
#include <corebuffer.h> template <class T> class Array: protected Core::IO::Buffer { public: // construction Array(T* buffer = nullptr, uint32 size = 0, bool copy = true); Array(uint32 size, bool initWithZero = true); // methods bool resize(uint32 newSize); void zeroFill(); INLINE T* getAddress(); INLINE const T* getAddress() const; INLINE uint32 getSize() const; INLINE operator T* (); INLINE operator const T * () const; INLINE T& operator [] (int index); INLINE const T& operator [] (int index) const; };
Inherited Members
public: // methods Buffer& take(Buffer& buffer); void* getAddress(); const void* getAddress() const; void* getAddressAligned(); const void* getAddressAligned() const; bool isNull() const; uint32 getSize() const; uint32 getAlignment() const; bool resize(uint32 newSize); void setAlignment(uint32 alignment); bool setValidSize(uint32 newSize); void zeroFill(); void byteFill(uint8 value); uint32 copyFrom(const void* src, uint32 srcSize); uint32 copyFrom(uint32 dstOffset, const void* src, uint32 srcSize); uint32 copyTo(void* dst, uint32 dstSize) const; template <class T> T* as(); template <class T> const T* as() const; operator void * (); operator char * (); operator const void * () const; operator const char * () const; bool operator == (const Buffer& buffer) const;
Detailed Documentation
Template class for element-based buffers.
Construction
Array(T* buffer = nullptr, uint32 size = 0, bool copy = true)
[HEAVY/LIGHT] Construct array with existing data.
Copies or just wraps the data.
Array(uint32 size, bool initWithZero = true)
[HEAVY] Construct array with given size.
Always allocates a new heap block.
Methods
bool resize(uint32 newSize)
Resize array to given number of elements.
void zeroFill()
Fill array with zeros.
INLINE T* getAddress()
Get array start address (writable).
INLINE const T* getAddress() const
Get array start address (read-only).
INLINE uint32 getSize() const
Get array size, i.e.
max. number of elements.