当前位置: 首页>>代码示例>>C++>>正文


C++ NamingContext_var::destroy方法代码示例

本文整理汇总了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"));
  }
}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:34,代码来源:NamingTreeCtrl.cpp

示例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 ();
}
开发者ID:binary42,项目名称:OCI,代码行数:60,代码来源:Hash_Naming_Context.cpp

示例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"));
    }
}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:14,代码来源:client.cpp


注:本文中的cosnaming::NamingContext_var::destroy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。