Open CASCADE Technology  7.7.0.dev
Public Types | Public Member Functions | Protected Attributes

IntPolyh_Array< Type > Class Template Reference

#include <IntPolyh_Array.hxx>

Public Types

typedef NCollection_Vector< Type > IntPolyh_VectorOfType
 

Public Member Functions

 IntPolyh_Array (const Standard_Integer aIncrement=256)
 
 IntPolyh_Array (const Standard_Integer aN, const Standard_Integer aIncrement=256)
 
IntPolyh_Arrayoperator= (const IntPolyh_Array &aOther)
 
IntPolyh_ArrayCopy (const IntPolyh_Array &aOther)
 
void Init (const Standard_Integer aN)
 
void IncrementNbItems ()
 
Standard_Integer GetN () const
 
Standard_Integer NbItems () const
 
void SetNbItems (const Standard_Integer aNb)
 
const Type & Value (const Standard_Integer aIndex) const
 
const Type & operator[] (const Standard_Integer aIndex) const
 
Type & ChangeValue (const Standard_Integer aIndex)
 
Type & operator[] (const Standard_Integer aIndex)
 
void Dump () const
 

Protected Attributes

Standard_Integer myNbAllocated
 
Standard_Integer myNbItems
 
Standard_Integer myIncrement
 
IntPolyh_VectorOfType myVectorOfType
 

Detailed Description

template<class Type>
class IntPolyh_Array< Type >

Class IntPolyh_Array (dynamic array of objects)

  1. The Array is dynamic array of objects.
  2. The Array uses NCollection_Vector to store objects
  3. The Array can be created: 3.1. with initial length Nb=0. In this case Array should be initiated by invoke the method Init(Nb). 3.2. with initial length Nb>0. In this case Array is initiated automatically.

    The memory is allocated to store myNbAllocated oblects.

  4. The number of items that are stored in the Array (myNbItems) can be increased by calling the method: IncrementNbItems(). The objects are stored in already allocated memory if it is possible. Otherwise the new chunk of memory is allocated to store the objects. The size of chunk <aIncrement> can be defined during the creation of the Array.
  5. The start index of the Array is 0, The end index of the Array can be obtained by the method NbItems();
  6. The contents of the element with index "i" can be queried or modified by the methods: Value(i), ChangeValue(i), operator[](i)

Member Typedef Documentation

◆ IntPolyh_VectorOfType

template<class Type >
typedef NCollection_Vector<Type> IntPolyh_Array< Type >::IntPolyh_VectorOfType

Constructor & Destructor Documentation

◆ IntPolyh_Array() [1/2]

template<class Type >
IntPolyh_Array< Type >::IntPolyh_Array ( const Standard_Integer  aIncrement = 256)
inline

Constructor.

Parameters
aIncrementsize of memory (in terms of Items) to expand the array

◆ IntPolyh_Array() [2/2]

template<class Type >
IntPolyh_Array< Type >::IntPolyh_Array ( const Standard_Integer  aN,
const Standard_Integer  aIncrement = 256 
)
inline

Constructor.

Parameters
aNsize of memory (in terms of Items) to allocate
aIncrementsize of memory (in terms of Items) to expand the array

Member Function Documentation

◆ ChangeValue()

template<class Type >
Type& IntPolyh_Array< Type >::ChangeValue ( const Standard_Integer  aIndex)
inline

query the value

Parameters
aIndexindex
Returns
the item

◆ Copy()

template<class Type >
IntPolyh_Array& IntPolyh_Array< Type >::Copy ( const IntPolyh_Array< Type > &  aOther)
inline

Copy

Parameters
aOther- the array to copy from
Returns
the array

◆ Dump()

template<class Type >
void IntPolyh_Array< Type >::Dump ( ) const
inline

dump the contents

◆ GetN()

template<class Type >
Standard_Integer IntPolyh_Array< Type >::GetN ( ) const
inline

GetN - returns the number of 'allocated' items

Returns
the number of 'allocated' items

◆ IncrementNbItems()

template<class Type >
void IntPolyh_Array< Type >::IncrementNbItems ( )
inline

IncrementNbItems - increment the number of stored items

◆ Init()

template<class Type >
void IntPolyh_Array< Type >::Init ( const Standard_Integer  aN)
inline

Init - allocate memory for <aN> items

Parameters
aN- the number of items to allocate the memory

◆ NbItems()

template<class Type >
Standard_Integer IntPolyh_Array< Type >::NbItems ( ) const
inline

NbItems - returns the number of stored items

Returns
the number of stored items

◆ operator=()

template<class Type >
IntPolyh_Array& IntPolyh_Array< Type >::operator= ( const IntPolyh_Array< Type > &  aOther)
inline

Assignment operator

Parameters
aOther- the array to copy from
Returns
the array

◆ operator[]() [1/2]

template<class Type >
Type& IntPolyh_Array< Type >::operator[] ( const Standard_Integer  aIndex)
inline

query the value

Parameters
aIndexindex
Returns
the item

◆ operator[]() [2/2]

template<class Type >
const Type& IntPolyh_Array< Type >::operator[] ( const Standard_Integer  aIndex) const
inline

query the const value

Parameters
aIndexindex
Returns
the const item

◆ SetNbItems()

template<class Type >
void IntPolyh_Array< Type >::SetNbItems ( const Standard_Integer  aNb)
inline

set the number of stored items

Parameters
aNbthe number of stored items

◆ Value()

template<class Type >
const Type& IntPolyh_Array< Type >::Value ( const Standard_Integer  aIndex) const
inline

query the const value

Parameters
aIndexindex
Returns
the const item

Field Documentation

◆ myIncrement

template<class Type >
Standard_Integer IntPolyh_Array< Type >::myIncrement
protected

◆ myNbAllocated

template<class Type >
Standard_Integer IntPolyh_Array< Type >::myNbAllocated
protected

◆ myNbItems

template<class Type >
Standard_Integer IntPolyh_Array< Type >::myNbItems
protected

◆ myVectorOfType

template<class Type >
IntPolyh_VectorOfType IntPolyh_Array< Type >::myVectorOfType
protected

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