Assert (create if not found), the required hdbObject
| Return Type | Function name | Arguments |
|---|---|---|
| hzEcode | hdsInfo::ObjectAssert | (hzString&,hdbClass*,) |
Declared in file: hzDissemino.h
Defined in file : hdsCore.cpp
Function Logic:
Function body:
hzEcode hdsInfo::ObjectAssert (hzString& objKey)hdbClass* pClass,
{
// Category: Dissemino Operation
//
// Assert (create if not found), the required hdbObject
//
// Arguments: 1) objKey The application name for the hdbObject instance
// 2) classname The object host class
//
// Returns: E_CORRUPT If the class does not exist or the objKey exists but for a different class
// E_OK If the user session either has or can add the object
hzList<hdbObject*>::Iter objI ; // Object iterator
// const hdbClass* pClass ; // Host class of object
hdbObject* pObj_test ; // Test object pointer
if (!m_Objects.Count())
{
m_pObj = new hdbObject() ;
m_pObj->Init(pClass) ;
if (objKey)
m_pObj->SetName(objKey) ;
m_Objects.Add(m_pObj) ;
return E_OK ;
}
m_pObj = 0;
for (objI = m_Objects ; objI.Valid() ; objI++)
{
pObj_test = objI.Element() ;
if (pObj_test->ObjKey() != objKey)
continue ;
m_pObj = pObj_test ;
break ;
}
if (!m_pObj)
{
m_pObj = new hdbObject() ;
m_pObj->Init(pClass) ;
if (objKey)
m_pObj->SetName(objKey) ;
m_Objects.Add(m_pObj) ;
}
return E_OK ;
}