Purpose: Delete an element at position. Method: This calls _findDnodeByPos to eastablish the target data node and slot for the requested position within the ISAM. It then calls _expelData() to delete the slot from the target node.
| Return Type | Function name | Arguments |
|---|---|---|
| hzEcode | _hz_tmpl_ISAM::DeletePosn | (uint32_t,) |
Declared in file: hzIsamT.h
Defined in file : hzIsamT.cpp
Function Logic:
Function body:
hzEcode _hz_tmpl_ISAM::DeletePosn (uint32_t nPosn)
{
// Purpose: Delete an element at position.
//
// Method: This calls _findDnodeByPos to eastablish the target data node and slot for the requested position within the ISAM. It then calls _expelData() to delete
// the slot from the target node.
//
// Arguments: 1) nPosn Position of object to delete
//
// Returns: E_OK If operation successful
// E_RANGE If position was invalid
// E_NODATA If element was a null
// E_MEMORY If there was insufficient memory
_hzfunc("_hz_tmpl_ISAM::DeletePosn") ;
_hz_vn_Dat* pTgt = 0; // Target data node (from which delete will occur)
int32_t nSlot ; // Position within node
// Check args
if (!Root())
return E_NOTFOUND ;
if (nPosn < 0|| nPosn >&eq; Cumulative())
return E_RANGE ;
// Locate the 'target' top level node
pTgt = (_hz_vn_Dat*) _findDnodeByPos(nSlot, nPosn, false) ;
if (!pTgt)
Fatal("Isam=%d: No data node found in spite of position %d being within range %d\n", IsamId(), nPosn, Cumulative()) ;
if (nSlot >&eq; HZ_T_ISAMNODE_FULL)
Fatal("Isam=%d: Illegal slot no %d for node %d\n", IsamId(), nSlot, pTgt->m_Id) ;
// Expel the entity from the node
// mx->m_nElements-- ;
_expelDataSlot(pTgt, nSlot) ;
if (Count() != Population())
Fatal("Isam=%d: Expected population %d, actual %d\n", IsamId(), Population(), Count()) ;
return E_OK ;
}