hdbIndexUkey is implimented as a 1:1 map between unique keys and the id of the data object that has the key. As HDB indexes are applied to data object members, the map must use keys of the same data type as the member concerned. hdbIndexUkey initialization is a matter of checking that the data type is compatible with a hdbIndexUkey index, then of creating a 1:1 map of the type to object ids (uint32_t).

Return TypeFunction nameArguments
hzEcodehdbIndexUkey::Init(hdbObjRepos*,hzString&,hdbBasetype,)

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

Function Logic:

0:START 1:unknown 2:Return hzerr(E_SEQUENCE,%s already initialized,*m_Name) 3:unknown 4:items 5:m_Name m_Name m_Name 6:dtype 7:BASETYPE_STRING 8:m_keys

Function body:

hzEcode hdbIndexUkey::Init (hdbObjRepos* pRepos)hzString& mbrName, hdbBasetype dtype, 
{
   //  hdbIndexUkey is implimented as a 1:1 map between unique keys and the id of the data object that has the key. As HDB indexes are applied to data object members, the map must
   //  use keys of the same data type as the member concerned. hdbIndexUkey initialization is a matter of checking that the data type is compatible with a hdbIndexUkey index, then
   //  of creating a 1:1 map of the type to object ids (uint32_t). 
   //  
   //  Arguments: 1) dtype The data type of the member to which the index applies
   //  
   //  Returns: E_TYPE If the supplied HadronZoo data type is undefned or cannot be applied to a hdbIndexUkey
   //     E_OK If the operation was successful
   _hzfunc("hdbIndexUkey::Init") ;
   hzEcode rc = E_OK ;     //  Return code
   if (m_bInit)
       return hzerr(E_SEQUENCE, "%s already initialized", *m_Name) ;
   if (!pRepos)
       hzexit(E_ARGUMENT, "No repository supplied") ;
   //  m_pRepos = pRepos ;
   m_Name = pRepos->txtName() ;
   m_Name += "::" ;
   m_Name += mbrName ;
   switch  (dtype)
   {
   //  case BASETYPE_DIGEST: m_keys.pMd5  = new hzMapS <hzMD5,uint32_t> ;  break ;
   case BASETYPE_STRING:   m_keys.pStr     = new hzMapS    <hzString,uint32_t> ;   break ;
   case BASETYPE_DOMAIN:   m_keys.pDom     = new hzMapS    <hzDomain,uint32_t> ;   break ;
   case BASETYPE_EMADDR:   m_keys.pEma     = new hzMapS    <hzEmaddr,uint32_t> ;   break ;
   case BASETYPE_URL:      m_keys.pUrl     = new hzMapS    <hzUrl,uint32_t> ;      break ;
   case BASETYPE_IPADDR:   m_keys.pIpa     = new hzMapS    <hzIpaddr,uint32_t> ;   break ;
   case BASETYPE_TIME:     m_keys.pTime    = new hzMapS    <hzTime,uint32_t> ;     break ;
   case BASETYPE_SDATE:    m_keys.pSD      = new hzMapS    <hzSDate,uint32_t> ;    break ;
   case BASETYPE_XDATE:    m_keys.pXD      = new hzMapS    <hzXDate,uint32_t> ;    break ;
   case BASETYPE_INT64:    m_keys.pSI64    = new hzMapS    <int64_t,uint32_t> ;    break ;
   case BASETYPE_UINT64:   m_keys.pUI64    = new hzMapS    <uint64_t,uint32_t> ;   break ;
   case BASETYPE_INT32:    m_keys.pSI32    = new hzMapS    <int32_t,uint32_t> ;    break ;
   case BASETYPE_UINT32:   m_keys.pUI32    = new hzMapS    <uint32_t,uint32_t> ;   break ;
   default:
       rc = E_TYPE ;
       break ;
   }
   if (rc == E_OK)
   {
       m_eBasetype = dtype ;
       m_bInit = true ;
   }
   return rc ;
}