Open CASCADE Technology  6.9.1
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

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

Constructor & Destructor Documentation

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

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

query the value

Parameters
aIndexindex
Returns
the item
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
template<class Type>
void IntPolyh_Array< Type >::Dump ( ) const
inline

dump the contents

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

GetN - returns the number of 'allocated' items

Returns
the number of 'allocated' items
template<class Type>
void IntPolyh_Array< Type >::IncrementNbItems ( )
inline

IncrementNbItems - increment the number of stored items

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
template<class Type>
Standard_Integer IntPolyh_Array< Type >::NbItems ( ) const
inline

NbItems - returns the number of stored items

Returns
the number of stored items
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
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
template<class Type>
Type& IntPolyh_Array< Type >::operator[] ( const Standard_Integer  aIndex)
inline

query the value

Parameters
aIndexindex
Returns
the item
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
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

template<class Type>
Standard_Integer IntPolyh_Array< Type >::myIncrement
protected
template<class Type>
Standard_Integer IntPolyh_Array< Type >::myNbAllocated
protected
template<class Type>
Standard_Integer IntPolyh_Array< Type >::myNbItems
protected
template<class Type>
IntPolyh_VectorOfType IntPolyh_Array< Type >::myVectorOfType
protected

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