OCC Main Page | FoundationClasses | Toolkits | Packages | Class Hierarchy | Data Structures | File List | Data Fields | Globals

FoundationClasses
TKernel
NCollection


NCollection_Array1< TheItemType > Class Template Reference

#include <NCollection_Array1.hxx>

Inheritance diagram for NCollection_Array1< TheItemType >:

Inheritance graph
[legend]

Public Member Functions

 NCollection_Array1 (const Standard_Integer theLower, const Standard_Integer theUpper)
 Constructor.
 NCollection_Array1 (const NCollection_Array1 &theOther)
 Copy constructor.
 NCollection_Array1 (const TheItemType &theBegin, const Standard_Integer theLower, const Standard_Integer theUpper)
 C array-based constructor.
void Init (const TheItemType &theValue)
 Initialise the items with theValue.
virtual Standard_Integer Size (void) const
 Size query.
Standard_Integer Length (void) const
 Length query (the same).
Standard_Integer Lower (void) const
 Lower bound.
Standard_Integer Upper (void) const
 Upper bound.
Standard_Boolean IsDeletable (void) const
 myDeletable flag
Standard_Boolean IsAllocated (void) const
 IsAllocated flag - for naming compatibility.
virtual void Assign (const NCollection_BaseCollection< TheItemType > &theOther)
 Assign (any collection to this array).
NCollection_Array1operator= (const NCollection_Array1 &theOther)
 operator= (array to array)
const TheItemType & Value (const Standard_Integer theIndex) const
 Constant value access.
const TheItemType & operator() (const Standard_Integer theIndex) const
 operator() - alias to Value
TheItemType & ChangeValue (const Standard_Integer theIndex)
 Variable value access.
TheItemType & operator() (const Standard_Integer theIndex)
 operator() - alias to ChangeValue
void SetValue (const Standard_Integer theIndex, const TheItemType &theItem)
 Set value.
 ~NCollection_Array1 (void)
 Destructor - releases the memory.

Protected Attributes

Standard_Integer myLowerBound
Standard_Integer myUpperBound
Standard_Boolean myDeletable
 Flag showing who allocated the array.
TheItemType * myData
 Pointer to '0'th array item.

Private Member Functions

virtual TYPENAME NCollection_BaseCollection<
TheItemType >::Iterator
CreateIterator (void) const
 Method to create iterators for base collections.

Data Structures

class  Iterator
 Implementation of the Iterator interface. More...

Detailed Description

template<class TheItemType>
class NCollection_Array1< TheItemType >

Purpose: The class Array1 represents unidimensional arrays of fixed size known at run time. The range of the index is user defined. An array1 can be constructed with a "C array". This functionality is useful to call methods expecting an Array1. It allows to carry the bounds inside the arrays.

Examples: Item tab[100]; // An example with a C array Array1OfItem ttab (tab[0],1,100);

Array1OfItem tttab (ttab(10),10,20); // a slice of ttab

If you want to reindex an array from 1 to Length do :

Array1 tab1(tab(tab.Lower()),1,tab.Length());

Warning: Programs client of such a class must be independant of the range of the first element. Then, a C++ for loop must be written like this

for (i = A.Lower(); i <= A.Upper(); i++)

Changes: In comparison to TCollection the flag isAllocated was renamed into myDeletable (alike in the Array2). For naming compatibility the method IsAllocated remained in class along with IsDeletable.


Constructor & Destructor Documentation

template<class TheItemType>
NCollection_Array1< TheItemType >::NCollection_Array1 const Standard_Integer  theLower,
const Standard_Integer  theUpper
[inline]
 

template<class TheItemType>
NCollection_Array1< TheItemType >::NCollection_Array1 const NCollection_Array1< TheItemType > &  theOther  )  [inline]
 

template<class TheItemType>
NCollection_Array1< TheItemType >::NCollection_Array1 const TheItemType &  theBegin,
const Standard_Integer  theLower,
const Standard_Integer  theUpper
[inline]
 

template<class TheItemType>
NCollection_Array1< TheItemType >::~NCollection_Array1 void   )  [inline]
 


Member Function Documentation

template<class TheItemType>
virtual void NCollection_Array1< TheItemType >::Assign const NCollection_BaseCollection< TheItemType > &  theOther  )  [inline, virtual]
 

template<class TheItemType>
TheItemType& NCollection_Array1< TheItemType >::ChangeValue const Standard_Integer  theIndex  )  [inline]
 

template<class TheItemType>
virtual TYPENAME NCollection_BaseCollection<TheItemType>::Iterator& NCollection_Array1< TheItemType >::CreateIterator void   )  const [inline, private, virtual]
 

Implements NCollection_BaseCollection< TheItemType >.

template<class TheItemType>
void NCollection_Array1< TheItemType >::Init const TheItemType &  theValue  )  [inline]
 

template<class TheItemType>
Standard_Boolean NCollection_Array1< TheItemType >::IsAllocated void   )  const [inline]
 

template<class TheItemType>
Standard_Boolean NCollection_Array1< TheItemType >::IsDeletable void   )  const [inline]
 

template<class TheItemType>
Standard_Integer NCollection_Array1< TheItemType >::Length void   )  const [inline]
 

template<class TheItemType>
Standard_Integer NCollection_Array1< TheItemType >::Lower void   )  const [inline]
 

template<class TheItemType>
TheItemType& NCollection_Array1< TheItemType >::operator() const Standard_Integer  theIndex  )  [inline]
 

template<class TheItemType>
const TheItemType& NCollection_Array1< TheItemType >::operator() const Standard_Integer  theIndex  )  const [inline]
 

template<class TheItemType>
NCollection_Array1& NCollection_Array1< TheItemType >::operator= const NCollection_Array1< TheItemType > &  theOther  )  [inline]
 

template<class TheItemType>
void NCollection_Array1< TheItemType >::SetValue const Standard_Integer  theIndex,
const TheItemType &  theItem
[inline]
 

template<class TheItemType>
virtual Standard_Integer NCollection_Array1< TheItemType >::Size void   )  const [inline, virtual]
 

Implements NCollection_BaseCollection< TheItemType >.

template<class TheItemType>
Standard_Integer NCollection_Array1< TheItemType >::Upper void   )  const [inline]
 

template<class TheItemType>
const TheItemType& NCollection_Array1< TheItemType >::Value const Standard_Integer  theIndex  )  const [inline]
 


Field Documentation

template<class TheItemType>
TheItemType* NCollection_Array1< TheItemType >::myData [protected]
 

template<class TheItemType>
Standard_Boolean NCollection_Array1< TheItemType >::myDeletable [protected]
 

template<class TheItemType>
Standard_Integer NCollection_Array1< TheItemType >::myLowerBound [protected]
 

template<class TheItemType>
Standard_Integer NCollection_Array1< TheItemType >::myUpperBound [protected]
 


The documentation for this class was generated from the following file:
Generated on Mon Aug 25 13:12:51 2008 for OpenCASCADE by  doxygen 1.4.1