Place the actual binary datum member value into the supplied chain. This requires the object container to name a source repository.
| Return Type | Function name | Arguments |
|---|---|---|
| hzEcode | hdbObject::GetBinary | (hzChain&,hdbMember*,) |
Declared in file: hzDatabase.h
Defined in file : hdbObject.cpp
Function Logic:
Function body:
hzEcode hdbObject::GetBinary (hzChain& Z)hdbMember* pMbr,
{
// Place the actual binary datum member value into the supplied chain. This requires the object container to name a source repository.
//
// Arguments: 1) Z The hzChain to be set
// 2) pMbr Pointer to the data class member
//
// Returns: E_NOINIT If the object has not been initialized to a class
// E_CORRUPT If the supplied member number does not identify an object class member.
// E_NODATA If the binary datum repository could not be identified
// E_TYPE If the object class member is not atomic (is another class) or if the supplied atom has the wrong type.
// E_OK If the object class member has been set to the supplied atom value.
_hzfunc("hdbObject::GetBinary") ;
hzChain* pCh ; // Internal cast (binary datum)
uint32_t* pId ; // Internal cast (binary datum id)
hzEcode rc = E_OK ; // Return code
// Object has class?
if (!m_pClass) return hzerr(E_NOINIT, "Object has no 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()) ;
// Check member data type
if (pMbr->Basetype() != BASETYPE_BINARY && pMbr->Basetype() != BASETYPE_TXTDOC)
return E_TYPE ;
Z.Clear() ;
// Check for the default binary datum repository of the associated data object repository
if (!m_pRepos)
return hzerr(E_NOINIT, "No repository") ;
if (!m_pRepos->BinRepos())
return hzerr(E_NOINIT, "Associated repository has no binary datum repository") ;
if (!m_pRoot)
return E_OK ;
// The member space may already hold the binary in hzChain form. If so simply copy it
pCh = (hzChain*) (m_pRoot->m_Core + pMbr->OsetAux()) ;
if (pCh->Size())
{
Z = *pCh ;
return E_OK ;
}
// Binary datum not in-situ, fetch from the binary datum repository
pId = (uint32_t*) (m_pRoot->m_Core + pMbr->OsetStd()) ;
if (*pId)
{
// Fetch chain from the binary datum repository
rc = m_pRepos->BinRepos()->Fetch(Z, *pId) ;
}
return rc ;
}