Return actual in-situ object
| Return Type | Function name | Arguments |
|---|---|---|
| OBJ& | hzArray::operator[] | (uint32_t,) |
Declared and defined in file: hzTmplArray.h
Function Logic:
Function body:
OBJ& hzArray::operator[] (uint32_t nPosn)
{
// Return actual in-situ object
_hzfunc("hzArray::operator[]") ;
_hz_ar_indx* pIdx ; // Index node pointer
_hz_ar_data* pDN ; // Index node pointer
uint32_t x ; // Position reached so far
uint32_t n ; // Offest at current level
uint32_t f ; // Division factor
if (nPosn >&eq; mx->m_nCount)
{
mx->m_Default = mx->m_Null ;
return mx->m_Default ;
}
f = mx->m_nFactor ;
if (f == 1)
{
pDN = (_hz_ar_data*) mx->m_pRoot ;
n = nPosn ;
return pDN->m_Objs[nPosn] ;
}
pIdx = (_hz_ar_indx*) mx->m_pRoot ;
for (x = nPosn, f = mx->m_nFactor ; f >&eq; (HZ_ARRAY_NODESIZE * HZ_ARRAY_NODESIZE) ;)
{
n = x/f ; x %= f ; f /= HZ_ARRAY_NODESIZE ;
pIdx = (_hz_ar_indx*) pIdx->m_Ptrs[n] ;
}
pDN = (_hz_ar_data*) pIdx->m_Ptrs[x/f] ;
return pDN->m_Objs[x%f] ;
}