Open CASCADE Technology
7.7.0
|
Defines an array of values of configurable size. For instance, this class allows defining an array of 32-bit or 64-bit integer values with bitness determined in runtime. The element size in bytes (stride) should be specified at construction time. Indexation starts from 0 index. As actual type of element varies at runtime, element accessors are defined as templates. Memory for array is allocated with the given alignment (template parameter). More...
#include <NCollection_AliasedArray.hxx>
Public Member Functions | |
NCollection_AliasedArray (Standard_Integer theStride) | |
Empty constructor. More... | |
NCollection_AliasedArray (Standard_Integer theStride, Standard_Integer theLength) | |
Constructor. More... | |
NCollection_AliasedArray (const NCollection_AliasedArray &theOther) | |
Copy constructor. More... | |
NCollection_AliasedArray (NCollection_AliasedArray &&theOther) Standard_Noexcept | |
Move constructor. More... | |
template<typename Type_t > | |
NCollection_AliasedArray (const Type_t &theBegin, Standard_Integer theLength) | |
Constructor wrapping pre-allocated C-array of values without copying them. More... | |
Standard_Integer | Stride () const |
Returns an element size in bytes. More... | |
Standard_Integer | Size () const |
Size query. More... | |
Standard_Integer | Length () const |
Length query (the same as Size()) More... | |
Standard_Boolean | IsEmpty () const |
Return TRUE if array has zero length. More... | |
Standard_Integer | Lower () const |
Lower bound. More... | |
Standard_Integer | Upper () const |
Upper bound. More... | |
Standard_Boolean | IsDeletable () const |
myDeletable flag More... | |
Standard_Boolean | IsAllocated () const |
IsAllocated flag - for naming compatibility. More... | |
Standard_Size | SizeBytes () const |
Return buffer size in bytes. More... | |
NCollection_AliasedArray & | Assign (const NCollection_AliasedArray &theOther) |
Copies data of theOther array to this. This array should be pre-allocated and have the same length as theOther; otherwise exception Standard_DimensionMismatch is thrown. More... | |
NCollection_AliasedArray & | Move (NCollection_AliasedArray &theOther) |
Move assignment. This array will borrow all the data from theOther. The moved object will keep pointer to the memory buffer and range, but it will not free the buffer on destruction. More... | |
NCollection_AliasedArray & | operator= (const NCollection_AliasedArray &theOther) |
Assignment operator;. More... | |
NCollection_AliasedArray & | operator= (NCollection_AliasedArray &&theOther) |
Move assignment operator;. More... | |
void | Resize (Standard_Integer theLength, Standard_Boolean theToCopyData) |
Resizes the array to specified bounds. No re-allocation will be done if length of array does not change, but existing values will not be discarded if theToCopyData set to FALSE. More... | |
~NCollection_AliasedArray () | |
Destructor - releases the memory. More... | |
const Standard_Byte * | value (Standard_Integer theIndex) const |
Access raw bytes of specified element. More... | |
Standard_Byte * | changeValue (Standard_Integer theIndex) |
Access raw bytes of specified element. More... | |
template<typename Type_t > | |
void | Init (const Type_t &theValue) |
Initialize the items with theValue. More... | |
template<typename Type_t > | |
const Type_t & | Value (Standard_Integer theIndex) const |
Access element with specified position and type. This method requires size of a type matching stride value. More... | |
template<typename Type_t > | |
void | Value (Standard_Integer theIndex, Type_t &theValue) const |
Access element with specified position and type. This method requires size of a type matching stride value. More... | |
template<typename Type_t > | |
Type_t & | ChangeValue (Standard_Integer theIndex) |
Access element with specified position and type. This method requires size of a type matching stride value. More... | |
template<typename Type_t > | |
const Type_t & | Value2 (Standard_Integer theIndex) const |
Access element with specified position and type. This method allows wrapping element into smaller type (e.g. to alias 2-components within 3-component vector). More... | |
template<typename Type_t > | |
void | Value2 (Standard_Integer theIndex, Type_t &theValue) const |
Access element with specified position and type. This method allows wrapping element into smaller type (e.g. to alias 2-components within 3-component vector). More... | |
template<typename Type_t > | |
Type_t & | ChangeValue2 (Standard_Integer theIndex) |
Access element with specified position and type. This method allows wrapping element into smaller type (e.g. to alias 2-components within 3-component vector). More... | |
template<typename Type_t > | |
const Type_t & | First () const |
Return first element. More... | |
template<typename Type_t > | |
Type_t & | ChangeFirst () |
Return first element. More... | |
template<typename Type_t > | |
const Type_t & | Last () const |
Return last element. More... | |
template<typename Type_t > | |
Type_t & | ChangeLast () |
Return last element. More... | |
Protected Attributes | |
Standard_Byte * | myData |
data pointer More... | |
Standard_Integer | myStride |
element size More... | |
Standard_Integer | mySize |
number of elements More... | |
Standard_Boolean | myDeletable |
flag showing who allocated the array More... | |
Defines an array of values of configurable size. For instance, this class allows defining an array of 32-bit or 64-bit integer values with bitness determined in runtime. The element size in bytes (stride) should be specified at construction time. Indexation starts from 0 index. As actual type of element varies at runtime, element accessors are defined as templates. Memory for array is allocated with the given alignment (template parameter).
|
inline |
Empty constructor.
|
inline |
Constructor.
|
inline |
Copy constructor.
|
inline |
Move constructor.
|
inline |
Constructor wrapping pre-allocated C-array of values without copying them.
|
inline |
Destructor - releases the memory.
|
inline |
Copies data of theOther array to this. This array should be pre-allocated and have the same length as theOther; otherwise exception Standard_DimensionMismatch is thrown.
|
inline |
Return first element.
|
inline |
Return last element.
|
inline |
Access raw bytes of specified element.
|
inline |
Access element with specified position and type. This method requires size of a type matching stride value.
|
inline |
Access element with specified position and type. This method allows wrapping element into smaller type (e.g. to alias 2-components within 3-component vector).
|
inline |
Return first element.
|
inline |
Initialize the items with theValue.
|
inline |
IsAllocated flag - for naming compatibility.
|
inline |
myDeletable flag
|
inline |
Return TRUE if array has zero length.
|
inline |
Return last element.
|
inline |
Length query (the same as Size())
|
inline |
Lower bound.
|
inline |
Move assignment. This array will borrow all the data from theOther. The moved object will keep pointer to the memory buffer and range, but it will not free the buffer on destruction.
|
inline |
Assignment operator;.
|
inline |
Move assignment operator;.
|
inline |
Resizes the array to specified bounds. No re-allocation will be done if length of array does not change, but existing values will not be discarded if theToCopyData set to FALSE.
theLength | new length of array |
theToCopyData | flag to copy existing data into new array |
|
inline |
Size query.
|
inline |
Return buffer size in bytes.
|
inline |
Returns an element size in bytes.
|
inline |
Upper bound.
|
inline |
Access raw bytes of specified element.
|
inline |
Access element with specified position and type. This method requires size of a type matching stride value.
|
inline |
Access element with specified position and type. This method requires size of a type matching stride value.
|
inline |
Access element with specified position and type. This method allows wrapping element into smaller type (e.g. to alias 2-components within 3-component vector).
|
inline |
Access element with specified position and type. This method allows wrapping element into smaller type (e.g. to alias 2-components within 3-component vector).
|
protected |
data pointer
|
protected |
flag showing who allocated the array
|
protected |
number of elements
|
protected |
element size