⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ifr_removing_visitor.cpp

📁 这是广泛使用的通信开源项目,对于大容量,高并发的通讯要求完全能够胜任,他广泛可用于网络游戏医学图像网关的高qos要求.更详细的内容可阅读相应的材料
💻 CPP
字号:
/* -*- c++ -*- */
// ifr_removing_visitor.cpp,v 1.9 2003/11/18 14:55:09 smcqueen Exp

#include "ifr_removing_visitor.h"
#include "utl_scope.h"
#include "ast_root.h"

ACE_RCSID (IFR_Service,
           ifr_removing_visitor,
           "ifr_removing_visitor.cpp,v 1.9 2003/11/18 14:55:09 smcqueen Exp")

ifr_removing_visitor::ifr_removing_visitor (void)
{
}

ifr_removing_visitor::~ifr_removing_visitor (void)
{
}

int
ifr_removing_visitor::visit_scope (UTL_Scope *node)
{
  // Proceed if the number of members in our scope is greater than 0.
  if (node->nmembers () > 0)
    {
      // Initialize an iterator to iterate over our scope.
      UTL_ScopeActiveIterator si (node,
                                  UTL_Scope::IK_decls);

      AST_Decl *d = 0;

      ACE_DECLARE_NEW_CORBA_ENV;
      ACE_TRY
        {
          // Continue until each element is visited.
          while (!si.is_done ())
            {
              d = si.item ();

              if (d == 0)
                {
                  ACE_ERROR_RETURN ((
                      LM_ERROR,
                      ACE_TEXT ("(%N:%l) ifr_removing_visitor::visit_scope -")
                      ACE_TEXT (" bad node in this scope\n")
                    ),
                    -1
                  );
                }

              if (d->node_type () == AST_Decl::NT_pre_defined)
                {
                  // We can skip these - they don't get destroyed in the IfR.
                  si.next ();
                  continue;
                }

              CORBA::Contained_var top_level =
                be_global->repository ()->lookup_id (d->repoID ()
                                                     ACE_ENV_ARG_PARAMETER);
              ACE_TRY_CHECK;

              if (!CORBA::is_nil (top_level.in ()))
                {
                  // All we have to do is call destroy() on each IR object
                  // in the global scope, because destroy() works on all
                  // the contents recursively.
                  top_level->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
                  ACE_TRY_CHECK;
                }

              si.next ();
            }
        }
      ACE_CATCHANY
        {
          ACE_PRINT_EXCEPTION (
              ACE_ANY_EXCEPTION,
              ACE_TEXT ("ifr_removing_visitor::visit_scope")
            );

          return -1;
        }
      ACE_ENDTRY;
    }

  return 0;
}

int
ifr_removing_visitor::visit_root (AST_Root *node)
{
  ACE_DECLARE_NEW_CORBA_ENV;
  ACE_TRY
    {
      CORBA::Container_var new_scope =
        CORBA::Container::_narrow (be_global->repository ()
                                  ACE_ENV_ARG_PARAMETER);
      ACE_TRY_CHECK;

      if (be_global->ifr_scopes ().push (new_scope.in ()) != 0)
        {
          ACE_ERROR_RETURN ((
              LM_ERROR,
              ACE_TEXT ("(%N:%l) ifr_removing_visitor::visit_root -")
              ACE_TEXT (" scope push failed\n")
            ),
            -1
          );
        }

      if (this->visit_scope (node) == -1)
        {
          ACE_ERROR_RETURN ((
              LM_ERROR,
              ACE_TEXT ("(%N:%l) ifr_removing_visitor::visit_root -")
              ACE_TEXT (" visit_scope failed\n")
            ),
            -1
          );
        }

      CORBA::Container_ptr tmp = CORBA::Container::_nil ();

      if (be_global->ifr_scopes ().pop (tmp) != 0)
        {
          ACE_ERROR_RETURN ((
              LM_ERROR,
              ACE_TEXT ("(%N:%l) ifr_removing_visitor::visit_root -")
              ACE_TEXT (" scope pop failed\n")
            ),
            -1
          );
        }
    }
  ACE_CATCHANY
    {
      ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
                           ACE_TEXT ("visit_root"));

      return -1;
    }
  ACE_ENDTRY;

  return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -