Insert a new element with a key or update an existing element that matches the key. If root exists, reject
| Return Type | Function name | Arguments |
|---|---|---|
| hzEcode | hzNamering::AddRoot | (hzString&,) |
Declared in file: hzNamering.h
Defined in file : hzNamering.cpp
Function Logic:
Function body:
hzEcode hzNamering::AddRoot (hzString& root)
{
// Insert a new element with a key or update an existing element that matches the key.
// If root exists, reject
//
// Arguments: 1) root The root to add
//
// Returns: E_ARGUMENT If the supplied root name is blank
// E_DUPLICATE If a group with that root name already exists
// E_OK If the group is added
_hzfunc("hzNamering::AddRoot") ;
hzEcode rc = E_OK ; // Return code
if (!root)
return E_ARGUMENT ;
mx->m_Lock.LockWrite() ;
if (mx->m_Groups.Exists(root))
rc = E_DUPLICATE ;
else
{
mx->m_Groups.Insert(root) ;
mx->m_Roots.Insert(root,root) ;
mx->m_Members.Insert(root,root) ;
}
mx->m_Lock.Unlock() ;
return rc ;
}