Fetches a subclass object from the applicable member of this (host class) object. The supplied hdbObject (previously initialized to the subclass), is first cleared leaving its m_pRoot pointer as NULL. m_pRoot is then set to the fetched _obj_data, raising the copy count.

Return TypeFunction nameArguments
hzEcodehdbObject::GetObject(hdbObject&,hdbMember*,uint32_t,)

Declared in file: hzDatabase.h
Defined in file : hdbObject.cpp

Function Logic:

0:START 1:unknown 2:items 3:unknown 4:Return hzerr(E_NOINIT,Single object container not init to a data class) 5:unknown 6:Return hzerr(E_NOINIT,Subclass object container not init to a data class) 7:unknown 8:Return hzerr(E_ARGUMENT,No member supplied) 9:unknown 10:Return hzerr(E_CORRUPT,Member %s does not belong to class %s,pMbr->txtName(),m_pClass->txtName()) 11:unknown 12:Return hzerr(E_TYPE,Member %s is atomic,pMbr->txtName()) 13:unknown 14:Return hzerr(E_TYPE,Member %s is not of type class %s,pMbr->txtName(),sub.m_pClass->txtName()) 15:items m_pRoot pMCS m_pRoot pLitmus 16:unknown 17:pArr 18:unknown 19:Return E_NOTFOUND 20:pSub sub items 21:Return E_OK

Function body:

hzEcode hdbObject::GetObject (hdbObject& sub)hdbMember* pMbr, uint32_t nOset, 
{
   //  Fetches a subclass object from the applicable member of this (host class) object.
   //  
   //  The supplied hdbObject (previously initialized to the subclass), is first cleared leaving its m_pRoot pointer as NULL. m_pRoot is then set to the fetched _obj_data, raising
   //  the copy count.
   //  
   //  Arguments: 1) sub  The target subclass object container
   //     2) pMbr The applicable host class member
   //     3) nOset Position in array of subclass objects held by the host class member
   //  
   _hzfunc("hdbObject::GetObject") ;
   hzArray <_obj_data*>*   pArr ;      //  Cast of core entry to object array
   _obj_data*  pSub ;      //  Subclass object pointer
   uchar*      pMCS ;      //  Member core space
   uchar*      pLitmus ;   //  Litmus bits
   hzEcode     rc ;        //  Return code
   //  Object has class?
   if (!this)          hzexit(E_CORRUPT, "No instance") ;
   if (!m_pClass)      return hzerr(E_NOINIT, "Single object container not init to a data class") ;
   if (!sub.m_pClass)  return hzerr(E_NOINIT, "Subclass object container not init to a data class") ;
   if (!pMbr)          return hzerr(E_ARGUMENT, "No member supplied") ;
   if (pMbr->Class() != m_pClass)
       return hzerr(E_CORRUPT, "Member %s does not belong to class %s", pMbr->txtName(), m_pClass->txtName()) ;
   if (pMbr->Basetype() != BASETYPE_CLASS)
       return hzerr(E_TYPE, "Member %s is atomic", pMbr->txtName()) ;
   if (pMbr->Datatype() != sub.m_pClass)
       return hzerr(E_TYPE, "Member %s is not of type class %s", pMbr->txtName(), sub.m_pClass->txtName()) ;
   sub.Clear() ;
   //  Set litmus and core space pointers
   pMCS = m_pRoot->m_Core + pMbr->OsetStd() ;
   pLitmus = m_pRoot->m_Core + m_pClass->CoreLen() ;
   if (pLitmus[pMbr->Posn()] & LITMUS_SET)
   {
       //  Cast the array
       pArr = (hzArray<_obj_data*>*) pMCS ;
       if (nOset >&eq; pArr->Count())
           return E_NOTFOUND ;
       pSub = pArr->operator[](nOset) ;
       sub.m_pRoot = pSub ;
       sub.m_pRoot->m_copy++ ;
   }
   return E_OK ;
}