本文整理汇总了C++中cosnaming::NamingContext_var::destroy方法的典型用法代码示例。如果您正苦于以下问题:C++ NamingContext_var::destroy方法的具体用法?C++ NamingContext_var::destroy怎么用?C++ NamingContext_var::destroy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cosnaming::NamingContext_var
的用法示例。
在下文中一共展示了NamingContext_var::destroy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnContextPopupDestroy
void CNamingTreeCtrl::OnContextPopupDestroy()
{
// TODO: Add your command handler code here
if(MessageBox(ACE_TEXT ("Are you sure you want to destroy this context?"),
ACE_TEXT ("Confirm"), MB_YESNO | MB_ICONEXCLAMATION) != IDYES)
{
return;
}
HTREEITEM hItem = GetSelectedItem();
HTREEITEM hParent = GetParentItem(hItem);
if(!hParent)
{
return;
}
CNamingObject* pObject = GetTreeObject(hItem);
CNamingObject* pParent= GetTreeObject(hParent);
CosNaming::NamingContext_var Parent = pParent->NamingContext();
try
{
// First try to destroy, it will raise exception if its not empty
CosNaming::NamingContext_var Context = pObject->NamingContext();
Context->destroy();
// Ok its destroyed, clean up any children we might have laying around
ClearChildren(hItem);
DeleteItem(hItem);
// do the unbind
Parent->unbind(pObject->Name());
delete pObject;
}
catch(CORBA::Exception& ex)
{
MessageBox(ACE_TEXT_CHAR_TO_TCHAR (ex._rep_id()), ACE_TEXT ("CORBA::Exception"));
}
}
示例2: OBJECT_NOT_EXIST
CosNaming::NamingContext_ptr
TAO_Hash_Naming_Context::bind_new_context (const CosNaming::Name& n)
{
// Check to make sure this object didn't have <destroy> method
// invoked on it.
if (this->destroyed_)
throw CORBA::OBJECT_NOT_EXIST ();
// Get the length of the name.
CORBA::ULong name_len = n.length ();
// Check for invalid name.
if (name_len == 0)
throw CosNaming::NamingContext::InvalidName();
// If we received compound name, resolve it to get the context in
// which the binding should take place, then perform the operation on
// target context.
if (name_len > 1)
{
CosNaming::NamingContext_var context = this->get_context (n);
CosNaming::Name simple_name;
simple_name.length (1);
simple_name[0] = n[name_len - 1];
return context->bind_new_context (simple_name);
}
// If we received a simple name, we need to bind it in this context.
// Stores our new Naming Context.
CosNaming::NamingContext_var result = CosNaming::NamingContext::_nil ();
// Create new context.
result = this->new_context ();
// Bind the new context to the name.
try
{
this->bind_context (n, result.in ());
}
catch (const CORBA::Exception&)
{
// If the bind() operation fails we must destroy the recently
// created context, should any exceptions be raised by the
// destroy() operation we want to ignore them.
{
try
{
result->destroy ();
}
catch (const CORBA::Exception&)
{
}
}
// Re-raise the exception in bind_context()
throw;
}
return result._retn ();
}
示例3: catch
void
Destroy_Test::not_exist_test (CosNaming::NamingContext_var &ref)
{
try
{
ref->destroy ();
}
catch (const CORBA::OBJECT_NOT_EXIST&)
{
ACE_DEBUG ((LM_DEBUG,
"Destroy works properly\n"));
}
}