OCCT3D OCCT 8.0.1
OCCT documentation

Search guides and API reference

Enter at least two characters.

    Open CASCADE Technology Reference Manual 8.0.1
    NCollection_AliasedArray< MyAlignSize > Class Template Reference

    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>

    Inheritance diagram for NCollection_AliasedArray< MyAlignSize >:

    Public Member Functions

     NCollection_AliasedArray (int theStride)
     Empty constructor.
     NCollection_AliasedArray (int theStride, int theLength)
     Constructor.
     NCollection_AliasedArray (const NCollection_AliasedArray &theOther)
     Copy constructor.
     NCollection_AliasedArray (NCollection_AliasedArray &&theOther) noexcept
     Move constructor.
    template<typename Type_t>
     NCollection_AliasedArray (const Type_t &theBegin, int theLength)
     Constructor wrapping pre-allocated C-array of values without copying them.
    int Stride () const
     Returns an element size in bytes.
    int Size () const
     Size query.
    int Length () const
     Length query (the same as Size()).
    bool IsEmpty () const
     Return TRUE if array has zero length.
    int Lower () const
     Lower bound.
    int Upper () const
     Upper bound.
    bool IsDeletable () const
     myDeletable flag
    bool IsAllocated () const
     IsAllocated flag - for naming compatibility.
    size_t SizeBytes () const
     Return buffer size in bytes.
    NCollection_AliasedArrayAssign (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.
    NCollection_AliasedArrayMove (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.
    NCollection_AliasedArrayoperator= (const NCollection_AliasedArray &theOther)
     Assignment operator;.
    NCollection_AliasedArrayoperator= (NCollection_AliasedArray &&theOther)
     Move assignment operator;.
    void Resize (int theLength, bool 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.
     ~NCollection_AliasedArray ()
     Destructor - releases the memory.
    const uint8_t * value (int theIndex) const
     Access raw bytes of specified element.
    uint8_t * changeValue (int theIndex)
     Access raw bytes of specified element.
    template<typename Type_t>
    void Init (const Type_t &theValue)
     Initialize the items with theValue.
    template<typename Type_t>
    const Type_t & Value (int theIndex) const
     Access element with specified position and type. This method requires size of a type matching stride value.
    template<typename Type_t>
    void Value (int theIndex, Type_t &theValue) const
     Access element with specified position and type. This method requires size of a type matching stride value.
    template<typename Type_t>
    Type_t & ChangeValue (int theIndex)
     Access element with specified position and type. This method requires size of a type matching stride value.
    template<typename Type_t>
    const Type_t & Value2 (int 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).
    template<typename Type_t>
    void Value2 (int 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).
    template<typename Type_t>
    Type_t & ChangeValue2 (int 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).
    template<typename Type_t>
    const Type_t & First () const
     Return first element.
    template<typename Type_t>
    Type_t & ChangeFirst ()
     Return first element.
    template<typename Type_t>
    const Type_t & Last () const
     Return last element.
    template<typename Type_t>
    Type_t & ChangeLast ()
     Return last element.

    Protected Attributes

    uint8_t * myData
     data pointer
    int myStride
     element size
    int mySize
     number of elements
    bool myDeletable
     flag showing who allocated the array

    Detailed Description

    template<int MyAlignSize = 16>
    class NCollection_AliasedArray< MyAlignSize >

    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).

    Constructor & Destructor Documentation

    ◆ NCollection_AliasedArray() [1/5]

    template<int MyAlignSize = 16>
    NCollection_AliasedArray< MyAlignSize >::NCollection_AliasedArray ( int theStride)
    inline

    Empty constructor.

    ◆ NCollection_AliasedArray() [2/5]

    template<int MyAlignSize = 16>
    NCollection_AliasedArray< MyAlignSize >::NCollection_AliasedArray ( int theStride,
    int theLength )
    inline

    Constructor.

    ◆ NCollection_AliasedArray() [3/5]

    template<int MyAlignSize = 16>
    NCollection_AliasedArray< MyAlignSize >::NCollection_AliasedArray ( const NCollection_AliasedArray< MyAlignSize > & theOther)
    inline

    Copy constructor.

    ◆ NCollection_AliasedArray() [4/5]

    template<int MyAlignSize = 16>
    NCollection_AliasedArray< MyAlignSize >::NCollection_AliasedArray ( NCollection_AliasedArray< MyAlignSize > && theOther)
    inlinenoexcept

    Move constructor.

    ◆ NCollection_AliasedArray() [5/5]

    template<int MyAlignSize = 16>
    template<typename Type_t>
    NCollection_AliasedArray< MyAlignSize >::NCollection_AliasedArray ( const Type_t & theBegin,
    int theLength )
    inline

    Constructor wrapping pre-allocated C-array of values without copying them.

    ◆ ~NCollection_AliasedArray()

    template<int MyAlignSize = 16>
    NCollection_AliasedArray< MyAlignSize >::~NCollection_AliasedArray ( )
    inline

    Destructor - releases the memory.

    Member Function Documentation

    ◆ Assign()

    template<int MyAlignSize = 16>
    NCollection_AliasedArray & NCollection_AliasedArray< MyAlignSize >::Assign ( const NCollection_AliasedArray< MyAlignSize > & theOther)
    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.

    ◆ ChangeFirst()

    template<int MyAlignSize = 16>
    template<typename Type_t>
    Type_t & NCollection_AliasedArray< MyAlignSize >::ChangeFirst ( )
    inline

    Return first element.

    ◆ ChangeLast()

    template<int MyAlignSize = 16>
    template<typename Type_t>
    Type_t & NCollection_AliasedArray< MyAlignSize >::ChangeLast ( )
    inline

    Return last element.

    ◆ ChangeValue()

    template<int MyAlignSize = 16>
    template<typename Type_t>
    Type_t & NCollection_AliasedArray< MyAlignSize >::ChangeValue ( int theIndex)
    inline

    Access element with specified position and type. This method requires size of a type matching stride value.

    ◆ changeValue()

    template<int MyAlignSize = 16>
    uint8_t * NCollection_AliasedArray< MyAlignSize >::changeValue ( int theIndex)
    inline

    Access raw bytes of specified element.

    ◆ ChangeValue2()

    template<int MyAlignSize = 16>
    template<typename Type_t>
    Type_t & NCollection_AliasedArray< MyAlignSize >::ChangeValue2 ( int theIndex)
    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).

    ◆ First()

    template<int MyAlignSize = 16>
    template<typename Type_t>
    const Type_t & NCollection_AliasedArray< MyAlignSize >::First ( ) const
    inline

    Return first element.

    ◆ Init()

    template<int MyAlignSize = 16>
    template<typename Type_t>
    void NCollection_AliasedArray< MyAlignSize >::Init ( const Type_t & theValue)
    inline

    Initialize the items with theValue.

    ◆ IsAllocated()

    template<int MyAlignSize = 16>
    bool NCollection_AliasedArray< MyAlignSize >::IsAllocated ( ) const
    inline

    IsAllocated flag - for naming compatibility.

    ◆ IsDeletable()

    template<int MyAlignSize = 16>
    bool NCollection_AliasedArray< MyAlignSize >::IsDeletable ( ) const
    inline

    myDeletable flag

    ◆ IsEmpty()

    template<int MyAlignSize = 16>
    bool NCollection_AliasedArray< MyAlignSize >::IsEmpty ( ) const
    inline

    Return TRUE if array has zero length.

    ◆ Last()

    template<int MyAlignSize = 16>
    template<typename Type_t>
    const Type_t & NCollection_AliasedArray< MyAlignSize >::Last ( ) const
    inline

    Return last element.

    ◆ Length()

    template<int MyAlignSize = 16>
    int NCollection_AliasedArray< MyAlignSize >::Length ( ) const
    inline

    Length query (the same as Size()).

    ◆ Lower()

    template<int MyAlignSize = 16>
    int NCollection_AliasedArray< MyAlignSize >::Lower ( ) const
    inline

    Lower bound.

    ◆ Move()

    template<int MyAlignSize = 16>
    NCollection_AliasedArray & NCollection_AliasedArray< MyAlignSize >::Move ( NCollection_AliasedArray< MyAlignSize > & theOther)
    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.

    ◆ operator=() [1/2]

    template<int MyAlignSize = 16>
    NCollection_AliasedArray & NCollection_AliasedArray< MyAlignSize >::operator= ( const NCollection_AliasedArray< MyAlignSize > & theOther)
    inline

    Assignment operator;.

    See also
    Assign()

    ◆ operator=() [2/2]

    template<int MyAlignSize = 16>
    NCollection_AliasedArray & NCollection_AliasedArray< MyAlignSize >::operator= ( NCollection_AliasedArray< MyAlignSize > && theOther)
    inline

    Move assignment operator;.

    See also
    Move()

    ◆ Resize()

    template<int MyAlignSize = 16>
    void NCollection_AliasedArray< MyAlignSize >::Resize ( int theLength,
    bool theToCopyData )
    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.

    Parameters
    theLengthnew length of array
    theToCopyDataflag to copy existing data into new array

    ◆ Size()

    template<int MyAlignSize = 16>
    int NCollection_AliasedArray< MyAlignSize >::Size ( ) const
    inline

    Size query.

    ◆ SizeBytes()

    template<int MyAlignSize = 16>
    size_t NCollection_AliasedArray< MyAlignSize >::SizeBytes ( ) const
    inline

    Return buffer size in bytes.

    ◆ Stride()

    template<int MyAlignSize = 16>
    int NCollection_AliasedArray< MyAlignSize >::Stride ( ) const
    inline

    Returns an element size in bytes.

    ◆ Upper()

    template<int MyAlignSize = 16>
    int NCollection_AliasedArray< MyAlignSize >::Upper ( ) const
    inline

    Upper bound.

    ◆ Value() [1/2]

    template<int MyAlignSize = 16>
    template<typename Type_t>
    const Type_t & NCollection_AliasedArray< MyAlignSize >::Value ( int theIndex) const
    inline

    Access element with specified position and type. This method requires size of a type matching stride value.

    ◆ Value() [2/2]

    template<int MyAlignSize = 16>
    template<typename Type_t>
    void NCollection_AliasedArray< MyAlignSize >::Value ( int theIndex,
    Type_t & theValue ) const
    inline

    Access element with specified position and type. This method requires size of a type matching stride value.

    ◆ value()

    template<int MyAlignSize = 16>
    const uint8_t * NCollection_AliasedArray< MyAlignSize >::value ( int theIndex) const
    inline

    Access raw bytes of specified element.

    ◆ Value2() [1/2]

    template<int MyAlignSize = 16>
    template<typename Type_t>
    const Type_t & NCollection_AliasedArray< MyAlignSize >::Value2 ( int theIndex) const
    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).

    ◆ Value2() [2/2]

    template<int MyAlignSize = 16>
    template<typename Type_t>
    void NCollection_AliasedArray< MyAlignSize >::Value2 ( int theIndex,
    Type_t & theValue ) const
    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).

    Field Documentation

    ◆ myData

    template<int MyAlignSize = 16>
    uint8_t* NCollection_AliasedArray< MyAlignSize >::myData
    protected

    data pointer

    ◆ myDeletable

    template<int MyAlignSize = 16>
    bool NCollection_AliasedArray< MyAlignSize >::myDeletable
    protected

    flag showing who allocated the array

    ◆ mySize

    template<int MyAlignSize = 16>
    int NCollection_AliasedArray< MyAlignSize >::mySize
    protected

    number of elements

    ◆ myStride

    template<int MyAlignSize = 16>
    int NCollection_AliasedArray< MyAlignSize >::myStride
    protected

    element size


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