![]() |
Open CASCADE Technology Reference Manual 8.0.0
|
#include <NCollection_SparseArrayBase.hxx>

Data Structures | |
| class | Iterator |
Public Types | |
Function pointer types for type-specific item operations | |
| using | CreateItemFunc = void (*)(void* theAddress, void* theOther) |
| Copy-construct a new item at theAddress from theOther. | |
| using | DestroyItemFunc = void (*)(void* theAddress) |
| Destroy the item at theAddress. | |
| using | CopyItemFunc = void (*)(void* theAddress, void* theOther) |
| Copy-assign the item at theAddress from theOther. | |
Public Member Functions | |
Type-independent public interface | |
| size_t | Size () const noexcept |
| Returns number of currently contained items. | |
| bool | HasValue (const size_t theIndex) const |
| Check whether the value at given index is set. | |
Protected Member Functions | |
| NCollection_SparseArrayBase (size_t theItemSize, size_t theBlockSize, DestroyItemFunc theDestroyItem) noexcept | |
| Constructor; initialized by size of item, block size, and item destructor function. | |
| ~NCollection_SparseArrayBase () | |
| Destructor; properly destroys all items and frees all memory. Uses the stored DestroyItemFunc, so no virtual dispatch is needed. | |
| Block | getBlock (void *const theAddr) const noexcept |
| Creates Block structure for block pointed by theAddr. | |
| void * | getItem (const Block &theBlock, size_t theInd) const noexcept |
| Find address of the item in the block by index (in the block) | |
| void * | getValue (const size_t theIndex) const |
| Direct const access to the item. | |
| void | clearItems (DestroyItemFunc theDestroyItem) |
| Clears all items and frees all memory. | |
| bool | unsetValue (const size_t theIndex, DestroyItemFunc theDestroyItem) |
| Deletes the item at theIndex from the array; returns True if the item was defined. | |
| void * | setValue (const size_t theIndex, void *const theValue, CreateItemFunc theCreateItem, CopyItemFunc theCopyItem) |
| Set a value to the specified item; returns address of the set item. | |
| void | assign (const NCollection_SparseArrayBase &theOther, CreateItemFunc theCreateItem, DestroyItemFunc theDestroyItem, CopyItemFunc theCopyItem) |
| Copy contents of theOther to this; assumes that this and theOther have exactly the same type of arguments. | |
| void | exchange (NCollection_SparseArrayBase &theOther) noexcept |
| Exchange contents of theOther and this; assumes that this and theOther have exactly the same type of arguments. | |
Protected Attributes | |
| size_t | myItemSize |
| size of item | |
| size_t | myBlockSize |
| block size (in items) | |
| size_t | myNbBlocks |
| allocated size of blocks table | |
| size_t | mySize |
| number of currently defined items | |
| void ** | myData |
| array of pointers to data blocks | |
| DestroyItemFunc | myDestroyItem |
| function to call destructor on items | |
Base class for NCollection_SparseArray; provides non-template implementation of general mechanics of block allocation, items creation / deletion etc.
Type-specific item operations (construction, destruction, copy) are provided by the derived template class via function pointers passed as arguments to the protected methods.
Copy-assign the item at theAddress from theOther.
Copy-construct a new item at theAddress from theOther.
Destroy the item at theAddress.
|
inlineprotectednoexcept |
Constructor; initialized by size of item, block size, and item destructor function.
| theDestroyItem | is stored to enable proper item destruction in the base destructor |
|
inlineprotected |
Destructor; properly destroys all items and frees all memory. Uses the stored DestroyItemFunc, so no virtual dispatch is needed.
|
protected |
Copy contents of theOther to this; assumes that this and theOther have exactly the same type of arguments.
| theCreateItem | function to copy-construct a new item |
| theDestroyItem | function to call destructor on an item |
| theCopyItem | function to copy-assign an existing item |
|
protected |
Clears all items and frees all memory.
| theDestroyItem | function to call destructor on each item |
|
protectednoexcept |
Exchange contents of theOther and this; assumes that this and theOther have exactly the same type of arguments.
|
inlineprotectednoexcept |
Creates Block structure for block pointed by theAddr.
|
inlineprotectednoexcept |
Find address of the item in the block by index (in the block)
Direct const access to the item.
Check whether the value at given index is set.
|
protected |
Set a value to the specified item; returns address of the set item.
| theCreateItem | function to copy-construct a new item |
| theCopyItem | function to copy-assign an existing item |
|
inlinenoexcept |
Returns number of currently contained items.
|
protected |
Deletes the item at theIndex from the array; returns True if the item was defined.
| theDestroyItem | function to call destructor on the item |
|
protected |
block size (in items)
|
protected |
array of pointers to data blocks
|
protected |
function to call destructor on items
|
protected |
size of item
|
protected |
allocated size of blocks table
|
protected |
number of currently defined items