# FoundationClasses
TKernel
NCollection

# NCollection_SparseArrayBase Class Reference

`#include <NCollection_SparseArrayBase.hxx>`

Inheritance diagram for NCollection_SparseArrayBase:

[legend]

## Public Member Functions

Type-independent public interface
Standard_EXPORT void | Clear ()
| Clears all the data.
Standard_Integer | Size () const
| Returns number of currently contained items.
Standard_EXPORT Standard_Boolean | HasValue (const Standard_Integer theIndex) const
| Check whether the value at given index is set.
Standard_EXPORT Standard_Boolean | UnsetValue (const Standard_Integer theIndex)
| Deletes the item from the array; returns True if that item was defined.

## Protected Member Functions

| NCollection_SparseArrayBase (Standard_Size theItemSize, Standard_Size theBlockSize)
| Constructor; initialized by size of item and of block (in items).
virtual | ~NCollection_SparseArrayBase ()
| Destructor.
Block | getBlock (const Standard_Address theAddr) const
| Creates Block structure for block pointed by theAddr.
Standard_Address | getItem (const Block &theBlock, Standard_Size theInd) const
| Find address of the item in the block by index (in the block).
Standard_Address | getValue (const Standard_Integer theIndex) const
| Direct const access to the item.
Standard_EXPORT Standard_Address | setValue (const Standard_Integer theIndex, const Standard_Address theValue)
| Set a value to the specified item; returns address of the set item.
Standard_EXPORT Standard_Address | changeValue (const Standard_Integer theIndex)
| Modification access to the item; allocates necessary space and marks the item as defined.
Standard_EXPORT void | assign (const NCollection_SparseArrayBase &theOther)
| Copy contents of theOther to this; assumes that this and theOther have exactly the same type of arguments.
Standard_EXPORT void | exchange (NCollection_SparseArrayBase &theOther)
| Exchange contents of theOther and this; assumes that this and theOther have exactly the same type of arguments.
virtual void | createItem (Standard_Address theAddress, Standard_Address theOther)=0
| Create new item at the specified address with copy constructor from existing item.
virtual void | destroyItem (Standard_Address theAddress)=0
| Call destructor to the item.
virtual void | copyItem (Standard_Address theAddress, Standard_Address theOther)=0
| Call assignment operator to the item.

## Protected Attributes

Standard_Size | myItemSize
| size of item
Standard_Size | myBlockSize
| block size (in items)
Standard_Size | myNbBlocks
| allocated size of blocks table
Standard_Size | mySize
| number of currently defined items
Standard_Address * | myData
| array of pointers to data blocks

## Private Member Functions

| NCollection_SparseArrayBase (const NCollection_SparseArrayBase &)
void | operator= (const NCollection_SparseArrayBase &)
void | allocData (const Standard_Size iBlock)
| Allocate space for at least iBlock+1 blocks.
void | freeBlock (const Standard_Size iBlock)
| Free specified block.

## Data Structures

class | Block
class | Iterator

## Detailed Description

Base class for NCollection_SparseArray; provides non-template implementation of general mechanics of block allocation, items creation / deletion etc.

## Constructor & Destructor Documentation

NCollection_SparseArrayBase::NCollection_SparseArrayBase | ( | const NCollection_SparseArrayBase & |  | ) | `[inline, private]`

NCollection_SparseArrayBase::NCollection_SparseArrayBase | ( | Standard_Size | theItemSize,
|  | Standard_Size | theBlockSize
| ) | `[inline, protected]`

virtual NCollection_SparseArrayBase::~NCollection_SparseArrayBase | ( |  | ) | `[inline, protected, virtual]`

## Member Function Documentation

void NCollection_SparseArrayBase::allocData | ( | const Standard_Size | iBlock | ) | `[private]`

Standard_EXPORT void NCollection_SparseArrayBase::assign | ( | const NCollection_SparseArrayBase & | theOther | ) | `[protected]`

Standard_EXPORT Standard_Address NCollection_SparseArrayBase::changeValue | ( | const Standard_Integer | theIndex | ) | `[protected]`

Standard_EXPORT void NCollection_SparseArrayBase::Clear | ( |  | ) |

virtual void NCollection_SparseArrayBase::copyItem | ( | Standard_Address | theAddress,
|  | Standard_Address | theOther
| ) | `[protected, pure virtual]`

| Implemented in NCollection_SparseArray< TheItemType >.

virtual void NCollection_SparseArrayBase::createItem | ( | Standard_Address | theAddress,
|  | Standard_Address | theOther
| ) | `[protected, pure virtual]`

| Implemented in NCollection_SparseArray< TheItemType >.

virtual void NCollection_SparseArrayBase::destroyItem | ( | Standard_Address | theAddress | ) | `[protected, pure virtual]`

| Implemented in NCollection_SparseArray< TheItemType >.

Standard_EXPORT void NCollection_SparseArrayBase::exchange | ( | NCollection_SparseArrayBase & | theOther | ) | `[protected]`

void NCollection_SparseArrayBase::freeBlock | ( | const Standard_Size | iBlock | ) | `[private]`

Block NCollection_SparseArrayBase::getBlock | ( | const Standard_Address | theAddr | ) | const`[inline, protected]`

Standard_Address NCollection_SparseArrayBase::getItem | ( | const Block & | theBlock,
|  | Standard_Size | theInd
| ) | const`[inline, protected]`

Standard_Address NCollection_SparseArrayBase::getValue | ( | const Standard_Integer | theIndex | ) | const`[inline, protected]`

Standard_EXPORT Standard_Boolean NCollection_SparseArrayBase::HasValue | ( | const Standard_Integer | theIndex | ) | const

void NCollection_SparseArrayBase::operator= | ( | const NCollection_SparseArrayBase & |  | ) | `[inline, private]`

Standard_EXPORT Standard_Address NCollection_SparseArrayBase::setValue | ( | const Standard_Integer | theIndex,
|  | const Standard_Address | theValue
| ) | `[protected]`

Standard_Integer NCollection_SparseArrayBase::Size | ( |  | ) | const`[inline]`

Standard_EXPORT Standard_Boolean NCollection_SparseArrayBase::UnsetValue | ( | const Standard_Integer | theIndex | ) |

## Field Documentation

Standard_Size NCollection_SparseArrayBase::myBlockSize `[protected]`

Standard_Address* NCollection_SparseArrayBase::myData `[protected]`

Standard_Size NCollection_SparseArrayBase::myItemSize `[protected]`

Standard_Size NCollection_SparseArrayBase::myNbBlocks `[protected]`

Standard_Size NCollection_SparseArrayBase::mySize `[protected]`

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

- NCollection_SparseArrayBase.hxx