Clear the atom value to null. Note this does not set the type to undefined. Arguments: None

Return TypeFunction nameArguments
hzAtom&hzAtom::Clear(void)

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

Function Logic:

0:START 1:unknown 2:unknown 3:unknown 4:items 5:m_Data m_eStatus m_eType 6:unknown 7:items 8:items 9:m_Data m_eStatus m_eType 10:Return *this 11:unknown 12:unknown 13:items 14:unknown 15:items 16:m_Data m_eStatus m_eType 17:Return *this 18:unknown 19:unknown 20:items 21:items 22:unknown 23:unknown 24:[](uchar*)m_Data.m_pVoid 25:unknown 26:unknown 27:items items 28:unknown 29:items items 30:unknown 31:items items 32:unknown 33:items items m_Data m_eType m_eStatus 34:Return *this

Function body:

hzAtom& hzAtom::Clear (void)
{
   //  Clear the atom value to null. Note this does not set the type to undefined.
   //  
   //  Arguments: None
   //  Returns: Reference to this atom
   _hzfunc("hzAtom::Clear") ;
   //  Check atom integrity
   if (m_eStatus == ATOM_CLEAR)
   {
       //  Must not have either data type or value
       if (m_eType == BASETYPE_UNDEF)
       {
           if (m_Data.m_uInt64)
               hzerr(E_CORRUPT, "Atom status clear, no data type but non-zero value") ;
           m_Data.m_uInt64 = 0;
           m_eStatus = ATOM_CLEAR ;
           m_eType = BASETYPE_UNDEF ;
       }
       else
       {
           if (m_Data.m_uInt64)
               hzerr(E_CORRUPT, "Atom status clear but has data type and value") ;
           else
               hzerr(E_CORRUPT, "Atom status clear, no value but type %s", Basetype2Txt(m_eType)) ;
           m_Data.m_uInt64 = 0;
           m_eStatus = ATOM_CLEAR ;
           m_eType = BASETYPE_UNDEF ;
       }
       //  Atom is clear so just return
       return *this ;
   }
   if (m_eStatus == ATOM_ERROR)
   {
       //  Must not have a type, cast, or a value
       if (m_eType != BASETYPE_UNDEF)  hzerr(E_CORRUPT, "Atom status error - but with data type %s", Basetype2Txt(m_eType)) ;
       if (m_Data.m_uInt64)            hzerr(E_CORRUPT, "Atom status error - but with value") ;
       m_Data.m_uInt64 = 0;
       m_eStatus = ATOM_CLEAR ;
       m_eType = BASETYPE_UNDEF ;
       return *this ;
   }
   if (m_eStatus == ATOM_SET)
   {
       //  Must have data type. Value could be 0 for numeric data types.
       if (m_eType == BASETYPE_UNDEF)
           hzexit(E_CORRUPT, "Atom status set but no data type") ;
   }
   else
   {
       //  Status is unknown
       hzexit(E_CORRUPT, "Atom status unknown") ;
   }
   //  To get this far the atom must be set, have data type and a legal value for the type
   if (m_eType == BASETYPE_DIGEST)
   {
       if (m_Data.m_pVoid)
           delete [] (uchar*) m_Data.m_pVoid ;
   }
   //  if (m_bCast && m_Data.m_uInt32)
   if (m_Data.m_uInt32)
   {
       if (m_eType == BASETYPE_STRING)
       {
           hzString    tmp ;
           tmp._int_set(m_Data.m_uInt32) ;
           tmp.Clear() ;
       }
       if (m_eType == BASETYPE_DOMAIN)
       {
           hzDomain    tmp ;
           tmp._int_set(m_Data.m_uInt32) ;
           tmp.Clear() ;
       }
       if (m_eType == BASETYPE_EMADDR)
       {
           hzEmaddr    tmp ;
           tmp._int_set(m_Data.m_uInt32) ;
           tmp.Clear() ;
       }
       if (m_eType == BASETYPE_URL)
       {
           hzUrl   tmp ;
           tmp._int_set(m_Data.m_uInt32) ;
           tmp.Clear() ;
       }
   }
   m_Data.m_uInt64 = 0;
   m_eType = BASETYPE_UNDEF ;
   m_eStatus = ATOM_CLEAR ;
   //  m_bCast = 0 ;
   return *this ;
}