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

📄 ifr_adding_visitor.cpp

📁 这是广泛使用的通信开源项目,对于大容量,高并发的通讯要求完全能够胜任,他广泛可用于网络游戏医学图像网关的高qos要求.更详细的内容可阅读相应的材料
💻 CPP
📖 第 1 页 / 共 5 页
字号:
                                    ACE_ENV_ARG_PARAMETER);
              ACE_TRY_CHECK;

              this->visit_all_emits (node,
                                     extant_def.in ()
                                     ACE_ENV_ARG_PARAMETER);
              ACE_TRY_CHECK;

              this->visit_all_publishes (node,
                                         extant_def.in ()
                                         ACE_ENV_ARG_PARAMETER);
              ACE_TRY_CHECK;

              this->visit_all_consumes (node,
                                        extant_def.in ()
                                        ACE_ENV_ARG_PARAMETER);
              ACE_TRY_CHECK;

              node->ifr_added (1);

              // Push the new IR object onto the scope stack before visiting
              // the new object's scope.
              if (be_global->ifr_scopes ().push (extant_def.in ()) != 0)
                {
                  ACE_ERROR_RETURN ((
                      LM_ERROR,
                      ACE_TEXT ("(%N:%l) ifr_adding_visitor::")
                      ACE_TEXT ("visit_component -")
                      ACE_TEXT (" scope push failed\n")
                    ),
                    -1
                  );
                }

              // Visit the members, if any.
              if (this->visit_scope (node) == -1)
                {
                  ACE_ERROR_RETURN ((
                      LM_ERROR,
                      ACE_TEXT ("(%N:%l) ifr_adding_visitor::")
                      ACE_TEXT ("visit_component -")
                      ACE_TEXT (" visit_scope failed\n")
                    ),
                    -1
                  );
                }

              // This spot in the AST doesn't necessarily have to be the
              // interface definition - it could be any reference to it.
              // The front end will already have fully defined it, so all
              // the info is available anywhere. So it's a good idea to
              // update the current IR object holder now.
              this->ir_current_ =
                CORBA::IDLType::_duplicate (extant_def.in ());

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

              // Pop the new IR object back off the scope stack.
              if (be_global->ifr_scopes ().pop (used_scope) != 0)
                {
                  ACE_ERROR_RETURN ((
                      LM_ERROR,
                      ACE_TEXT ("(%N:%l) ifr_adding_visitor::")
                      ACE_TEXT ("visit_interface -")
                      ACE_TEXT (" scope pop failed\n")
                    ),
                    -1
                  );
                }
             }
          else
            {
              // @@ (JP) I think we're ok here without a check:
              // not defined/not added - visit_interface_fwd will have
              //                         detected a clobber.
              // not defined/added - not possible.
              // defined/not added - takes the other branch.
              // defined/added - we're ok.
              this->ir_current_ = 
                CORBA::IDLType::_narrow (prev_def.in ()
                                         ACE_ENV_ARG_PARAMETER);
              ACE_TRY_CHECK;
            }
        }
   }
  ACE_CATCHANY
    {
      ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
                           ACE_TEXT ("visit_component"));

      return -1;
    }
  ACE_ENDTRY;

  return 0;
}

int 
ifr_adding_visitor::visit_component_fwd (AST_ComponentFwd *node)
{
  if (node->imported () && !be_global->do_included_files ())
    {
      return 0;
    }

  AST_Component *c = 
    AST_Component::narrow_from_decl (node->full_definition ());

  ACE_DECLARE_NEW_CORBA_ENV;
  ACE_TRY
    {
      // Is this interface already in the respository?
      CORBA::Contained_var prev_def =
        be_global->repository ()->lookup_id (c->repoID ()
                                             ACE_ENV_ARG_PARAMETER);
      ACE_TRY_CHECK;

      if (CORBA::is_nil (prev_def.in ()))
        {
          CORBA::Container_ptr current_scope =
            CORBA::Container::_nil ();

          if (be_global->ifr_scopes ().top (current_scope) == 0)
            {
              CORBA::ComponentIR::Container_var ccm_scope =
                CORBA::ComponentIR::Container::_narrow (
                                                   current_scope
                                                   ACE_ENV_ARG_PARAMETER
                                                 );
              ACE_TRY_CHECK;

              // If our full definition is found in this IDL file, we go
              // ahead and create the full entry now.
              // The forward declared component is not defined anywhere
              // in this IDL file, so we just create an empty entry to
              // be replaced by a full definition later.
              CORBA::InterfaceDefSeq supported_interfaces;
              supported_interfaces.length (0);
              CORBA::ComponentIR::ComponentDef_var base_component;


              if (node->is_defined ())
                {
                  this->fill_supported_interfaces (supported_interfaces,
                                                   c
                                                   ACE_ENV_ARG_PARAMETER);
                  ACE_TRY_CHECK;

                  this->fill_base_component (base_component.out (),
                                             c
                                             ACE_ENV_ARG_PARAMETER);
                  ACE_TRY_CHECK;
                }

              this->ir_current_ =
                ccm_scope->create_component (
                               c->repoID (),
                               c->local_name ()->get_string (),
                               c->version (),
                               base_component.in (),
                               supported_interfaces
                               ACE_ENV_ARG_PARAMETER
                             );
              ACE_TRY_CHECK;

              // Might as well go ahead and complete the repository
              // entry now, if we can - we're halfway there already.
              if (node->is_defined ())
                {
                  CORBA::ComponentIR::ComponentDef_var new_def =
                    CORBA::ComponentIR::ComponentDef::_narrow (
                        this->ir_current_.in ()
                        ACE_ENV_ARG_PARAMETER
                      );
                  ACE_TRY_CHECK;

                  this->visit_all_provides (c,
                                            new_def.in ()
                                            ACE_ENV_ARG_PARAMETER);
                  ACE_TRY_CHECK;

                  this->visit_all_uses (c,
                                        new_def.in ()
                                        ACE_ENV_ARG_PARAMETER);
                  ACE_TRY_CHECK;

                  this->visit_all_emits (c,
                                         new_def.in ()
                                         ACE_ENV_ARG_PARAMETER);
                  ACE_TRY_CHECK;

                  this->visit_all_publishes (c,
                                             new_def.in ()
                                             ACE_ENV_ARG_PARAMETER);
                  ACE_TRY_CHECK;

                  this->visit_all_consumes (c,
                                            new_def.in ()
                                            ACE_ENV_ARG_PARAMETER);
                  ACE_TRY_CHECK;
                }
            }
          else
            {
              ACE_ERROR_RETURN ((
                  LM_ERROR,
                  ACE_TEXT ("(%N:%l) ifr_adding_visitor::")
                  ACE_TEXT ("visit_component_fwd -")
                  ACE_TEXT (" scope stack is empty\n")
                ),
                -1
              );
            }

          node->ifr_added (1);
          c->ifr_fwd_added (1);
        }
   }
  ACE_CATCHANY
    {
      ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
                           ACE_TEXT ("visit_component_fwd"));

      return -1;
    }
  ACE_ENDTRY;

  return 0;
}

int 
ifr_adding_visitor::visit_eventtype (AST_EventType *node)
{
  if (node->imported () && !be_global->do_included_files ())
    {
      return 0;
    }

  ACE_DECLARE_NEW_CORBA_ENV;
  ACE_TRY
    {
      // Is this interface already in the respository?
      CORBA::Contained_var prev_def =
        be_global->repository ()->lookup_id (node->repoID ()
                                             ACE_ENV_ARG_PARAMETER);
      ACE_TRY_CHECK;

      // If not, create a new entry.
      if (CORBA::is_nil (prev_def.in ()))
        {
          int status = this->create_event_def (node
                                               ACE_ENV_ARG_PARAMETER);
          ACE_TRY_CHECK;

          return status;
        }
      else
        {
          // There is already an entry in the repository. If the interface is
          // defined and has not already been populated, we do so
          // now. If it is not yet defined or the full definition has already
          // been added to the repository, we just update the current IR object
          // holder.
          if (node->is_defined ()
              && node->ifr_added () == 0
              && this->in_reopened_ == 0)
            {
              // If we are here and the line below is true, then either
              // 1. We are defining an undefined forward declared interface
              //    from a previously processed IDL file, or
              // 2. We are clobbering a previous definition, either of an
              //    interface or of some other type.
              // 3. We are inside a module that has a previous entry.
              // If prev_def would narrow successfully to an InterfaceDef, we
              // have NO WAY of knowing if we are defining or clobbering. So
              // we destroy the contents of the previous entry (we don't want
              // to destroy the entry itself, since it may have already been
              // made a member of some other entry, and destroying it would
              // make the containing entry's key invalid) and repopulate.
              // On the other hand, if prev_def is NOT an interface, we can
              // safely destroy it, since we know we are not redefining a
              // previous entry, forward declared or not.
              // If we are inside a module that was seen before, we could be
              // just processing an IDL file a second time, in which case we
              // again just update ir_current_.
              if (node->ifr_fwd_added () == 0)
                {
                  CORBA::DefinitionKind kind =
                    prev_def->def_kind (ACE_ENV_SINGLE_ARG_PARAMETER);
                  ACE_TRY_CHECK;

                  if (kind == CORBA::dk_Value)
                    {
                      CORBA::ComponentIR::EventDef_var event =
                        CORBA::ComponentIR::EventDef::_narrow (
                            prev_def.in ()
                            ACE_ENV_ARG_PARAMETER
                          );
                      ACE_TRY_CHECK;

                      CORBA::ContainedSeq_var contents =
                        event->contents (CORBA::dk_all,
                                         1
                                         ACE_ENV_ARG_PARAMETER);
                      ACE_TRY_CHECK;

                      CORBA::ULong length = contents->length ();

                      for (CORBA::ULong i = 0; i < length; ++i)
                        {
                          contents[i]->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
                          ACE_TRY_CHECK;
                        }
                    }
                  else
                    {
                      prev_def->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
                      ACE_TRY_CHECK;

                      int status = 
                        this->create_event_def (node
                                                ACE_ENV_ARG_PARAMETER);
                      ACE_TRY_CHECK;

                      return status;
                    }
                }

              // Our previous definition is a valuetype, so narrow it here,
              // then populate it.
              CORBA::ComponentIR::EventDef_var extant_def =
                CORBA::ComponentIR::EventDef::_narrow (prev_def. in ()
                                                       ACE_ENV_ARG_PARAMETER);
              ACE_TRY_CHECK;

              // Concrete base value.

              CORBA::ValueDef_var base_vt;
              this->fill_base_value (base_vt.out (),
                                     node
                                     ACE_ENV_ARG_PARAMETER);
              ACE_TRY_CHECK;

              extant_def->base_value (base_vt.in ()
                                      ACE_ENV_ARG_PARAMETER);
              ACE_TRY_CHECK;

              // Abstract base values.

              CORBA::ValueDefSeq abstract_base_values;
              this->fill_abstract_base_values (abstract_base_values,
                                               node
                                               ACE_ENV_ARG_PARAMETER);

⌨️ 快捷键说明

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