Add a child to this visible entity. Returns: E_OK

Return TypeFunction nameArguments
hzEcodehdsVE::AddChild(hdsVE*,)

Declared in file: hzDissemino.h
Defined in file : hdsCore.cpp

Function Logic:

0:START 1:unknown 2:items 3:unknown 4:items 5:unknown 6:items 7:unknown 8:items 9:unknown 10:m_Children 11:pVE 12:unknown 13:unknown 14:unknown 15:Return E_OK 16:unknown 17:items 18:pVE 19:items 20:Return E_OK

Function body:

hzEcode hdsVE::AddChild (hdsVE* pChild)
{
   //  Category: Dissemino System Initialization
   //  
   //  Add a child to this visible entity.
   //  
   //  Arguments: 1) pChild The pointer to the child visible entity
   //  
   //  Returns: E_OK
   _hzfunc("hdsVE::AddChild") ;
   hdsVE*  pVE ;   //  Visible entity pointer
   if (!pChild)
       hzexit(E_ARGUMENT, "%s: Null child supplied to Visible Entity", *m_Tag) ;
   if (m_flagVE & VE_COMPLETE)
       hzexit(E_SEQUENCE, "%s: Visible Entity is already complete, cannot add child %s", *m_Tag, *pChild->m_Tag) ;
   if (pChild == this)
       hzexit(E_CORRUPT, "%s: Child is same as parent", *m_Tag) ;
   if (!pChild->m_VID)
       hzexit(E_CORRUPT, "%s: Supplied child (%s) has no ID", *m_Tag, *pChild->m_Tag) ;
   //  Child VEs?
   if (!m_Children)
   {
       //  The current VE has no children so add the first
       m_Children = pChild->m_VID ;
   }
   else
   {
       //  Run through existing children and set the sibling of the last child to the new child. Note that if the child VE we are adding is already among existing children, we note
       //  the duplicate and return without adding.
       pVE = Children() ;
       if (pVE->Sibling())
       {
           for (; pVE && pVE->Sibling() ; pVE = pVE->Sibling())
           {
               if (pVE == pChild)
                   return E_OK ;
           }
       }
       if (!pVE)
           hzexit(E_CORRUPT, "Last child already had a sibling value") ;
       pVE->m_Sibling = pChild->m_VID ;
       //  pVE->SetSibling(pChild) ;
   }
   m_nChildren++ ;
   return E_OK ;
}