Open CASCADE Technology Reference Manual 8.0.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions
NCollection_HArray1< TheItemType > Class Template Reference

Template class for Handle-managed 1D arrays. Inherits from both NCollection_Array1<TheItemType> and Standard_Transient, providing reference-counted array functionality. More...

#include <NCollection_HArray1.hxx>

Inheritance diagram for NCollection_HArray1< TheItemType >:
Inheritance graph
[legend]

Public Types

typedef NCollection_Array1< TheItemTypeArray1Type
 
typedef TheItemType value_type
 
- Public Types inherited from NCollection_Array1< TheItemType >
typedef NCollection_Allocator< TheItemTypeallocator_type
 Memory allocation.
 
using value_type = TheItemType
 
using size_type = size_t
 
using difference_type = size_t
 
using pointer = TheItemType*
 
using const_pointer = const TheItemType*
 
using reference = TheItemType&
 
using const_reference = const TheItemType&
 
using iterator
 
using const_iterator
 
using Iterator = NCollection_Iterator<NCollection_Array1<TheItemType>>
 
- Public Types inherited from Standard_Transient
typedef void base_type
 Returns a type descriptor about this object.
 

Public Member Functions

 NCollection_HArray1 ()
 Default constructor.
 
 NCollection_HArray1 (const int theLower, const int theUpper)
 Constructor with bounds.
 
 NCollection_HArray1 (const int theLower, const int theUpper, const TheItemType &theValue)
 Constructor with bounds and initial value.
 
 NCollection_HArray1 (const TheItemType &theBegin, const int theLower, const int theUpper, const bool theUseBuffer)
 Constructor from C array.
 
 NCollection_HArray1 (const Array1Type &theOther)
 Copy constructor from array.
 
const Array1TypeArray1 () const noexcept
 Returns const reference to the underlying array.
 
Array1TypeChangeArray1 () noexcept
 Returns mutable reference to the underlying array.
 
- Public Member Functions inherited from NCollection_Array1< TheItemType >
const_iterator begin () const noexcept
 
iterator begin () noexcept
 
const_iterator cbegin () const noexcept
 
iterator end () noexcept
 
const_iterator end () const noexcept
 
const_iterator cend () const noexcept
 
 NCollection_Array1 () noexcept
 
 NCollection_Array1 (const int theLower, const int theUpper)
 
 NCollection_Array1 (const_reference theBegin, const int theLower, const int theUpper, const bool theUseBuffer=true)
 
 NCollection_Array1 (const size_t theSize)
 Zero-based constructor: allocates theSize elements with lower bound 0. Use At()/ChangeAt() or STL iterators for optimal access (no offset subtraction).
 
 NCollection_Array1 (pointer theBegin, const size_t theSize)
 Zero-based buffer-reuse constructor: wraps an existing C array of theSize elements. The array does NOT own the buffer and will NOT free it on destruction. Use At()/ChangeAt() or STL iterators for optimal access (no offset subtraction).
 
 NCollection_Array1 (const NCollection_Array1 &theOther)
 Copy constructor.
 
 NCollection_Array1 (NCollection_Array1 &&theOther) noexcept
 Move constructor.
 
virtual ~NCollection_Array1 ()
 
void Init (const_reference theValue)
 Initialise the items with theValue.
 
size_t Size () const noexcept
 Size query.
 
int Length () const noexcept
 Length query (legacy int-returning API).
 
bool IsEmpty () const noexcept
 Return TRUE if array has zero length.
 
int Lower () const noexcept
 Lower bound.
 
int Upper () const noexcept
 Upper bound.
 
NCollection_Array1Assign (const NCollection_Array1 &theOther)
 Replaces this array by a copy of theOther array. Bounds and length are copied from theOther. When this array wraps an external (non-owned) buffer:
 
NCollection_Array1CopyValues (const NCollection_Array1 &theOther)
 Copies values from theOther array without changing this array bounds. This array should be pre-allocated and have the same length as theOther; otherwise exception Standard_DimensionMismatch is thrown.
 
NCollection_Array1Move (NCollection_Array1 &&theOther) noexcept
 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_Array1Move (NCollection_Array1 &theOther) noexcept
 
NCollection_Array1operator= (const NCollection_Array1 &theOther)
 Assignment operator;.
 
NCollection_Array1operator= (NCollection_Array1 &&theOther) noexcept
 Move assignment operator;.
 
const_reference First () const noexcept
 
reference ChangeFirst () noexcept
 
const_reference Last () const noexcept
 
reference ChangeLast () noexcept
 
const_reference Value (const int theIndex) const
 Constant value access.
 
const_reference operator() (const int theIndex) const
 operator() - alias to Value
 
const_reference operator[] (const int theIndex) const
 operator[] - alias to Value
 
reference ChangeValue (const int theIndex)
 Variable value access.
 
reference operator() (const int theIndex)
 operator() - alias to ChangeValue
 
reference operator[] (const int theIndex)
 operator[] - alias to ChangeValue
 
const_reference At (const size_t theIndex) const
 0-based checked access independent of Lower()/Upper().
 
reference ChangeAt (const size_t theIndex)
 0-based checked mutable access independent of Lower()/Upper().
 
void SetValue (const int theIndex, const value_type &theItem)
 Set value.
 
void SetValue (const int theIndex, value_type &&theItem)
 Set value.
 
template<typename... Args>
reference EmplaceValue (const int theIndex, Args &&... theArgs)
 Emplace value at the specified index, constructing it in-place.
 
void UpdateLowerBound (const int theLower) noexcept
 Changes the lowest bound. Do not move data.
 
void UpdateUpperBound (const int theUpper) noexcept
 Changes the upper bound. Do not move data.
 
void Resize (const int theLower, const int theUpper, const 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.
 
void Resize (const size_t theSize, const bool theToCopyData)
 Resizes the array to theSize elements, keeping the lower bound unchanged.
 
bool IsDeletable () const noexcept
 
- Public Member Functions inherited from Standard_Transient
 Standard_Transient ()
 Empty constructor.
 
 Standard_Transient (const Standard_Transient &)
 Copy constructor – does nothing.
 
Standard_Transientoperator= (const Standard_Transient &)
 Assignment operator, needed to avoid copying reference counter.
 
virtual ~Standard_Transient ()=default
 Destructor must be virtual.
 
virtual const opencascade::handle< Standard_Type > & DynamicType () const
 Returns a type descriptor about this object.
 
bool IsInstance (const opencascade::handle< Standard_Type > &theType) const
 Returns a true value if this is an instance of Type.
 
bool IsInstance (const char *const theTypeName) const
 Returns a true value if this is an instance of TypeName.
 
bool IsKind (const opencascade::handle< Standard_Type > &theType) const
 Returns true if this is an instance of Type or an instance of any class that inherits from Type. Note that multiple inheritance is not supported by OCCT RTTI mechanism.
 
bool IsKind (const char *const theTypeName) const
 Returns true if this is an instance of TypeName or an instance of any class that inherits from TypeName. Note that multiple inheritance is not supported by OCCT RTTI mechanism.
 
Standard_TransientThis () const
 Returns non-const pointer to this object (like const_cast). For protection against creating handle to objects allocated in stack or call from constructor, it will raise exception Standard_ProgramError if reference counter is zero.
 
int GetRefCount () const noexcept
 Get the reference counter of this object.
 
void IncrementRefCounter () noexcept
 Increments the reference counter of this object. Uses relaxed memory ordering since incrementing only requires atomicity, not synchronization with other memory operations.
 
int DecrementRefCounter () noexcept
 Decrements the reference counter of this object; returns the decremented value. Uses release ordering for the decrement to ensure all writes to the object are visible before the count reaches zero. An acquire fence is added only when the count reaches zero, ensuring proper synchronization before deletion. This is more efficient than using acq_rel for every decrement.
 
virtual void Delete () const
 Memory deallocator for transient classes.
 

Additional Inherited Members

- Static Public Member Functions inherited from Standard_Transient
static constexpr const charget_type_name ()
 Returns a type descriptor about this object.
 
static const opencascade::handle< Standard_Type > & get_type_descriptor ()
 Returns type descriptor of Standard_Transient class.
 
- Data Fields inherited from NCollection_Array1< TheItemType >
friend iterator
 
friend const_iterator
 
- Protected Member Functions inherited from NCollection_Array1< TheItemType >
void resizeImpl (const size_t theNewSize, const int theNewLower, const bool theToCopyData)
 Core resize implementation used by all public Resize() overloads.
 
const_reference at (const size_t theIndex) const
 
reference at (const size_t theIndex)
 
template<typename U = TheItemType>
std::enable_if< std::is_trivially_default_constructible< U >::value, void >::type construct (const size_t, const size_t)
 
template<typename U = TheItemType>
std::enable_if<!std::is_trivially_default_constructible< U >::value, void >::type construct (const size_t theFrom, const size_t theTo)
 
template<typename U = TheItemType>
std::enable_if< std::is_trivially_destructible< U >::value, void >::type destroy (pointer, const size_t, const size_t)
 
template<typename U = TheItemType>
std::enable_if<!std::is_trivially_destructible< U >::value, void >::type destroy (pointer theWhat, const size_t theFrom, const size_t theTo)
 
void assign (const const_pointer theFrom, const size_t theSize, const int theLower)
 
template<typename U = TheItemType>
std::enable_if< std::is_trivially_copyable< U >::value, void >::type copyAssign (pointer theTarget, const_pointer theFrom, const size_t theCount)
 
template<typename U = TheItemType>
std::enable_if<!std::is_trivially_copyable< U >::value, void >::type copyAssign (pointer theTarget, const_pointer theFrom, const size_t theCount)
 
void copyConstruct (const pointer theFrom, const size_t theCount)
 
template<typename U = TheItemType>
std::enable_if< std::is_trivially_copyable< U >::value, void >::type copyConstruct (pointer theTarget, const_pointer theFrom, const size_t theCount)
 
template<typename U = TheItemType>
std::enable_if<!std::is_trivially_copyable< U >::value, void >::type copyConstruct (pointer theTarget, const_pointer theFrom, const size_t theCount)
 
- Protected Attributes inherited from NCollection_Array1< TheItemType >
int myLowerBound
 
size_t mySize
 
pointer myPointer = nullptr
 
bool myIsOwner = false
 
allocator_type myAllocator
 

Detailed Description

template<typename TheItemType>
class NCollection_HArray1< TheItemType >

Template class for Handle-managed 1D arrays. Inherits from both NCollection_Array1<TheItemType> and Standard_Transient, providing reference-counted array functionality.

Member Typedef Documentation

◆ Array1Type

◆ value_type

Constructor & Destructor Documentation

◆ NCollection_HArray1() [1/5]

Default constructor.

◆ NCollection_HArray1() [2/5]

template<typename TheItemType >
NCollection_HArray1< TheItemType >::NCollection_HArray1 ( const int theLower,
const int theUpper )
inline

Constructor with bounds.

Parameters
theLowerlower bound of the array
theUpperupper bound of the array

◆ NCollection_HArray1() [3/5]

template<typename TheItemType >
NCollection_HArray1< TheItemType >::NCollection_HArray1 ( const int theLower,
const int theUpper,
const TheItemType & theValue )
inline

Constructor with bounds and initial value.

Parameters
theLowerlower bound of the array
theUpperupper bound of the array
theValueinitial value for all elements

◆ NCollection_HArray1() [4/5]

template<typename TheItemType >
NCollection_HArray1< TheItemType >::NCollection_HArray1 ( const TheItemType & theBegin,
const int theLower,
const int theUpper,
const bool theUseBuffer )
inlineexplicit

Constructor from C array.

Parameters
theBeginreference to the first element of a C array
theLowerlower bound of the array
theUpperupper bound of the array
theUseBufferflag indicating whether to use external buffer (must be explicit)

◆ NCollection_HArray1() [5/5]

Copy constructor from array.

Parameters
theOtherthe array to copy from

Member Function Documentation

◆ Array1()

template<typename TheItemType >
const Array1Type & NCollection_HArray1< TheItemType >::Array1 ( ) const
inlinenoexcept

Returns const reference to the underlying array.

◆ ChangeArray1()

template<typename TheItemType >
Array1Type & NCollection_HArray1< TheItemType >::ChangeArray1 ( )
inlinenoexcept

Returns mutable reference to the underlying array.


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