OCCT 8.0.1
OCCT documentation

Search guides and API reference

Enter at least two characters.

    Open CASCADE Technology Reference Manual 8.0.1
    NCollection_SparseArrayBase Class Reference

    #include <NCollection_SparseArrayBase.hxx>

    Inheritance diagram for NCollection_SparseArrayBase:

    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

    Detailed Description

    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.

    Member Typedef Documentation

    ◆ CopyItemFunc

    using NCollection_SparseArrayBase::CopyItemFunc = void (*)(void* theAddress, void* theOther)

    Copy-assign the item at theAddress from theOther.

    ◆ CreateItemFunc

    using NCollection_SparseArrayBase::CreateItemFunc = void (*)(void* theAddress, void* theOther)

    Copy-construct a new item at theAddress from theOther.

    ◆ DestroyItemFunc

    Destroy the item at theAddress.

    Constructor & Destructor Documentation

    ◆ NCollection_SparseArrayBase()

    NCollection_SparseArrayBase::NCollection_SparseArrayBase ( size_t theItemSize,
    size_t theBlockSize,
    DestroyItemFunc theDestroyItem )
    inlineprotectednoexcept

    Constructor; initialized by size of item, block size, and item destructor function.

    Parameters
    theDestroyItemis stored to enable proper item destruction in the base destructor

    ◆ ~NCollection_SparseArrayBase()

    NCollection_SparseArrayBase::~NCollection_SparseArrayBase ( )
    inlineprotected

    Destructor; properly destroys all items and frees all memory. Uses the stored DestroyItemFunc, so no virtual dispatch is needed.

    Member Function Documentation

    ◆ assign()

    void NCollection_SparseArrayBase::assign ( const NCollection_SparseArrayBase & theOther,
    CreateItemFunc theCreateItem,
    DestroyItemFunc theDestroyItem,
    CopyItemFunc theCopyItem )
    protected

    Copy contents of theOther to this; assumes that this and theOther have exactly the same type of arguments.

    Parameters
    theCreateItemfunction to copy-construct a new item
    theDestroyItemfunction to call destructor on an item
    theCopyItemfunction to copy-assign an existing item

    ◆ clearItems()

    void NCollection_SparseArrayBase::clearItems ( DestroyItemFunc theDestroyItem)
    protected

    Clears all items and frees all memory.

    Parameters
    theDestroyItemfunction to call destructor on each item

    ◆ exchange()

    void NCollection_SparseArrayBase::exchange ( NCollection_SparseArrayBase & theOther)
    protectednoexcept

    Exchange contents of theOther and this; assumes that this and theOther have exactly the same type of arguments.

    ◆ getBlock()

    Block NCollection_SparseArrayBase::getBlock ( void *const theAddr) const
    inlineprotectednoexcept

    Creates Block structure for block pointed by theAddr.

    ◆ getItem()

    void * NCollection_SparseArrayBase::getItem ( const Block & theBlock,
    size_t theInd ) const
    inlineprotectednoexcept

    Find address of the item in the block by index (in the block).

    ◆ getValue()

    void * NCollection_SparseArrayBase::getValue ( const size_t theIndex) const
    inlineprotected

    Direct const access to the item.

    ◆ HasValue()

    bool NCollection_SparseArrayBase::HasValue ( const size_t theIndex) const

    Check whether the value at given index is set.

    ◆ setValue()

    void * NCollection_SparseArrayBase::setValue ( const size_t theIndex,
    void *const theValue,
    CreateItemFunc theCreateItem,
    CopyItemFunc theCopyItem )
    protected

    Set a value to the specified item; returns address of the set item.

    Parameters
    theCreateItemfunction to copy-construct a new item
    theCopyItemfunction to copy-assign an existing item

    ◆ Size()

    size_t NCollection_SparseArrayBase::Size ( ) const
    inlinenoexcept

    Returns number of currently contained items.

    ◆ unsetValue()

    bool NCollection_SparseArrayBase::unsetValue ( const size_t theIndex,
    DestroyItemFunc theDestroyItem )
    protected

    Deletes the item at theIndex from the array; returns True if the item was defined.

    Parameters
    theDestroyItemfunction to call destructor on the item

    Field Documentation

    ◆ myBlockSize

    size_t NCollection_SparseArrayBase::myBlockSize
    protected

    block size (in items)

    ◆ myData

    void** NCollection_SparseArrayBase::myData
    protected

    array of pointers to data blocks

    ◆ myDestroyItem

    DestroyItemFunc NCollection_SparseArrayBase::myDestroyItem
    protected

    function to call destructor on items

    ◆ myItemSize

    size_t NCollection_SparseArrayBase::myItemSize
    protected

    size of item

    ◆ myNbBlocks

    size_t NCollection_SparseArrayBase::myNbBlocks
    protected

    allocated size of blocks table

    ◆ mySize

    size_t NCollection_SparseArrayBase::mySize
    protected

    number of currently defined items


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