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


C++ AST_Decl::node_type方法代码示例

本文整理汇总了C++中AST_Decl::node_type方法的典型用法代码示例。如果您正苦于以下问题:C++ AST_Decl::node_type方法的具体用法?C++ AST_Decl::node_type怎么用?C++ AST_Decl::node_type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AST_Decl的用法示例。


在下文中一共展示了AST_Decl::node_type方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: while

int
be_visitor_enum_any_op_cs::visit_enum (be_enum *node)
{
  if (node->cli_stub_any_op_gen () || node->imported ())
    {
      return 0;
    }

  TAO_OutStream *os = this->ctx_->stream ();

  *os << be_nl_2 << "// TAO_IDL - Generated from" << be_nl
      << "// " << __FILE__ << ":" << __LINE__ << be_nl;

  *os << be_global->core_versioning_begin () << be_nl;

  // Since we don't generate CDR stream operators for types that
  // explicitly contain a local interface (at some level), we
  // must override these Any template class methods to avoid
  // calling the non-existent operators. The zero return value
  // will eventually cause CORBA::MARSHAL to be raised if this
  // type is inserted into an Any and then marshaled.
  if (node->is_local ())
    {
      *os << "namespace TAO" << be_nl
          << "{" << be_idt_nl
          << "template<>" << be_nl
          << "::CORBA::Boolean" << be_nl
          << "Any_Basic_Impl_T<" << node->name ()
          << ">::marshal_value (TAO_OutputCDR &)" << be_nl
          << "{" << be_idt_nl
          << "return false;" << be_uidt_nl
          << "}";

      *os << be_nl_2
          << "template<>" << be_nl
          << "::CORBA::Boolean" << be_nl
          << "Any_Basic_Impl_T<" << node->name ()
          << ">::demarshal_value (TAO_InputCDR &)" << be_nl
          << "{" << be_idt_nl
          << "return false;" << be_uidt_nl
          << "}" << be_uidt_nl
          << "}" << be_nl_2;
    }


  *os << be_global->core_versioning_end () << be_nl;

  be_module *module = 0;
  if (node->is_nested ())
    {
      AST_Decl *d = node;
      AST_Decl::NodeType nt = d->node_type ();

      while (nt != AST_Decl::NT_root)
        {
          if (nt == AST_Decl::NT_module)
            {
              module = be_module::narrow_from_decl (d);
              break;
            }
          else
            {
              d = ScopeAsDecl (d->defined_in ());
              nt = d->node_type ();
            }
        }

      if (module != 0)
        {
          // Some compilers handle "any" operators in a namespace corresponding
          // to their module, others do not.
          *os << "\n\n#if defined (ACE_ANY_OPS_USE_NAMESPACE)\n";

          be_util::gen_nested_namespace_begin (os, module);


          // Generate the Any <<= and >>= operator declarations
          // Any <<= and >>= operators.
          *os << "void operator<<= (" << be_idt << be_idt_nl
              << "::CORBA::Any &_tao_any," << be_nl
              << "::" << node->name () << " _tao_elem" << be_uidt_nl
              << ")" << be_uidt_nl
              << "{" << be_idt_nl
              << "TAO::Any_Basic_Impl_T< ::" << node->name () << ">::insert ("
              << be_idt << be_idt_nl
              << "_tao_any," << be_nl
              << "::" << node->tc_name () << "," << be_nl
              << "_tao_elem" << be_uidt_nl
              << ");" << be_uidt << be_uidt_nl
              << "}" << be_nl_2;

          *os << "::CORBA::Boolean operator>>= (" << be_idt << be_idt_nl
              << "const ::CORBA::Any &_tao_any," << be_nl
              << "::" << node->name () << " &_tao_elem" << be_uidt_nl
              << ")" << be_uidt_nl
              << "{" << be_idt_nl
              << "return" << be_idt_nl
              << "TAO::Any_Basic_Impl_T< ::" << node->name () << ">::extract ("
              << be_idt << be_idt_nl
              << "_tao_any," << be_nl
//.........这里部分代码省略.........
开发者ID:asdlei00,项目名称:ACE,代码行数:101,代码来源:any_op_cs.cpp

示例2:

UTL_NameList *
AST_Factory::fe_add_exceptions (UTL_NameList *t)
{
  UTL_ScopedName *nl_n = 0;
  AST_Type *fe = 0;
  AST_Decl *d = 0;

  this->pd_exceptions = 0;

  for (UTL_NamelistActiveIterator nl_i (t);
       !nl_i.is_done ();
       nl_i.next ())
    {
      nl_n = nl_i.item ();

      d = this->defined_in ()->lookup_by_name (nl_n, true);

      if (d == 0)
        {
          idl_global->err ()->lookup_error (nl_n);
          return 0;
        }

      AST_Decl::NodeType nt = d->node_type ();

      if (nt != AST_Decl::NT_except
          && nt != AST_Decl::NT_param_holder)
        {
          idl_global->err ()->error1 (UTL_Error::EIDL_ILLEGAL_RAISES,
                                      this);
          return 0;
        }

      fe = AST_Type::narrow_from_decl (d);

      UTL_ExceptList *el = 0;
      ACE_NEW_RETURN (el,
                      UTL_ExceptList (fe, 0),
                      0);

      if (this->pd_exceptions == 0)
        {
          this->pd_exceptions = el;
        }
      else
        {
          this->pd_exceptions->nconc (el);
        }

      this->pd_n_exceptions++;
    }

  // This return value is never used, it's easier to
  // destroy it here and return 0 than to destroy it
  // each place it is passed in.
  t->destroy ();
  delete t;
  t = 0;

  return t;
}
开发者ID:CCJY,项目名称:ATCD,代码行数:61,代码来源:ast_factory.cpp

示例3: switch

// NOTE: No attempt is made to ensure that exceptions are mentioned
//       only once..
UTL_NameList *
AST_Operation::fe_add_exceptions (UTL_NameList *t)
{
  if (0 == t)
    {
      return 0;
    }

  UTL_ScopedName *nl_n = 0;
  AST_Type *fe = 0;
  AST_Decl *d = 0;

  this->pd_exceptions = 0;

  for (UTL_NamelistActiveIterator nl_i (t); !nl_i.is_done (); nl_i.next ())
    {
      nl_n = nl_i.item ();
      d = this->lookup_by_name (nl_n, true);

      if (d == 0)
        {
          idl_global->err ()->lookup_error (nl_n);
          return 0;
        }

      AST_Decl::NodeType nt = d->node_type ();

      switch (nt)
        {
          case AST_Decl::NT_except:
            break;
          case AST_Decl::NT_param_holder:
            {
              AST_Param_Holder *ph =
                AST_Param_Holder::narrow_from_decl (d);

              nt = ph->info ()->type_;

              if (nt != AST_Decl::NT_except
                  && nt != AST_Decl::NT_type)
                {
                  idl_global->err ()->mismatched_template_param (
                    ph->info ()->name_.c_str ());
                }

              break;
            }
          case AST_Decl::NT_typedef:
            {
              AST_Typedef *td =
                AST_Typedef::narrow_from_decl (d);

              nt = td->primitive_base_type ()->node_type ();

              if (nt != AST_Decl::NT_except)
                {
                  idl_global->err ()->error1 (
                    UTL_Error::EIDL_ILLEGAL_RAISES,
                    this);
                }

              break;
            }
          case AST_Decl::NT_native:
            {
              // This is the only use case for this node type.
              int compare =
                ACE_OS::strcmp (d->local_name ()->get_string (),
                                "UserExceptionBase");

              if (compare != 0)
                {
                  idl_global->err ()->error1 (
                    UTL_Error::EIDL_ILLEGAL_RAISES,
                    this);
                }

              break;
            }
          default:
            idl_global->err ()->error1 (
              UTL_Error::EIDL_ILLEGAL_RAISES,
              this);

            break;
        };

      bool oneway_op =
        (this->flags () == AST_Operation::OP_oneway);

      fe = AST_Type::narrow_from_decl (d);

      if (oneway_op && fe != 0)
        {
          idl_global->err ()->error1 (UTL_Error::EIDL_ILLEGAL_RAISES,
                                      this);
        }

//.........这里部分代码省略.........
开发者ID:CCJY,项目名称:ATCD,代码行数:101,代码来源:ast_operation.cpp

示例4: Bailout

void
FE_ComponentHeader::compile_supports (UTL_NameList *supports)
{
  if (supports == 0)
    {
      return;
    }

  AST_Decl *d = 0;
  UTL_ScopedName *item = 0;
  AST_Interface *iface = 0;
  AST_Type *t = 0;
  long j = 0;
  long k = 0;

  // Compute expanded flattened non-repeating list of interfaces
  // which this one inherits from.

  for (UTL_NamelistActiveIterator l (supports); !l.is_done (); l.next ())
    {
      item = l.item ();

      // Check that scope stack is valid.
      if (idl_global->scopes ().top () == 0)
        {
          idl_global->err ()->lookup_error (item);

          // This is probably the result of bad IDL.
          // We will crash if we continue from here.
          throw Bailout ();
        }

      // Look it up.
      UTL_Scope *s = idl_global->scopes ().top ();

      d = s->lookup_by_name  (item, true);

      if (d == 0)
        {
          AST_Decl *sad = ScopeAsDecl (s);

          if (sad->node_type () == AST_Decl::NT_module)
            {
              AST_Module *m = AST_Module::narrow_from_decl (sad);

              d = m->look_in_prev_mods_local (item->last_component ());
            }
        }

      // Not found?
      if (d == 0)
        {
          idl_global->err ()->lookup_error (item);

          // This is probably the result of bad IDL.
          // We will crash if we continue from here.
          throw Bailout ();
        }

      // Remove typedefs, if any.
      if (d->node_type () == AST_Decl::NT_typedef)
        {
          d = AST_Typedef::narrow_from_decl (d)->primitive_base_type ();
        }

      AST_Decl::NodeType nt = d->node_type ();
      t = AST_Type::narrow_from_decl (d);

      if (nt == AST_Decl::NT_interface)
        {
          iface = AST_Interface::narrow_from_decl (d);

          // Undefined interface?
          if (!iface->is_defined ())
            {
              idl_global->err ()->inheritance_fwd_error (
                this->interface_name_,
                iface);

              continue;
            }

          // Local interface? (illegal for components to support).
          if (iface->is_local ())
            {
              idl_global->err ()->unconstrained_interface_expected (
                this->name (),
                iface->name ());

              continue;
           }
        }
      else if (nt == AST_Decl::NT_param_holder)
        {
          AST_Param_Holder *ph =
            AST_Param_Holder::narrow_from_decl (d);

          nt = ph->info ()->type_;

          if (nt != AST_Decl::NT_type
//.........这里部分代码省略.........
开发者ID:CCJY,项目名称:ATCD,代码行数:101,代码来源:fe_component_header.cpp

示例5: switch

int
be_visitor_connector_dds_exs::visit_connector (be_connector *node)
{
  if (node->imported ())
    {
      return 0;
    }

  if (!this->begin (node))
    {
      return -1;
    }

  // If we have a connector within a templated module
  if (! this->t_args_.is_empty ())
    {
      os_ << be_nl
          << this->node_->local_name () << "_exec_i::"
          << this->node_->local_name () << "_exec_i (void)"
          << be_idt_nl
          << ": " << this->base_tname_ << "_Connector_T";

      os_ << " <" << be_idt << be_idt_nl;

      os_ << "CCM_" << this->node_->flat_name ()
          << "_Traits," << be_nl;

      size_t slot = 1UL;

      for (FE_Utils::T_ARGLIST::CONST_ITERATOR i (this->t_args_);
          !i.done ();
          i.advance (), ++slot)
        {
          AST_Decl **item = 0;
          i.next (item);
          AST_Decl *d = *item;

          if (this->is_dds_type (node, d))
            {
              os_ << d->flat_name ()
                  << "_DDS_Traits";
            }
          else
            {
              os_ << d->name ();
            }

          bool needs_bool = false;
          bool is_fixed = false;
          FE_Utils::T_Param_Info *param = 0;

          if (this->t_params_->get (param, slot - 1) != 0)
            {
              ACE_ERROR_RETURN ((LM_ERROR,
                                 ACE_TEXT ("be_visitor_connector_dds_exh::")
                                 ACE_TEXT ("visit_connector - ")
                                 ACE_TEXT ("template param fetch failed\n ")),
                                -1);
            }

          if (d->node_type () == AST_Decl::NT_typedef)
            {
              /// Strip away all layers of typedef before narrowing.
              AST_Typedef *td = AST_Typedef::narrow_from_decl (d);
              d = td->primitive_base_type ();
            }

          /// No need to check if this is 0, but must narrow
          /// to call virtual function size_type() below.
          AST_Type *t = AST_Type::narrow_from_decl (d);

          switch (param->type_)
            {
              case AST_Decl::NT_type:
              case AST_Decl::NT_struct:
              case AST_Decl::NT_union:
                needs_bool = true;
                is_fixed = (t->size_type () == AST_Type::FIXED);
                break;
              default:
                break;
            }

          if (needs_bool)
            {
              os_ << "," << be_nl
                  << (is_fixed ? "true" : "false");
            }

          if (slot < this->t_args_.size ())
            {
              os_ << "," << be_nl;
            }
        }

      os_ << "> ()"
          << be_uidt << be_uidt << be_uidt_nl
          << "{" << be_nl
          << "}";

//.........这里部分代码省略.........
开发者ID:CCJY,项目名称:ATCD,代码行数:101,代码来源:connector_dds_exs.cpp

示例6: if

// This serves for structs and unions.
void
AST_Structure::fwd_redefinition_helper (AST_Structure *&i,
                                        UTL_Scope *s)
{
  if (i == 0)
    {
      return;
    }

  // Fwd redefinition should be in the same scope, so local
  // lookup is all that's needed.
  AST_Decl *d =
    s->lookup_by_name_local (i->local_name (), false);

  AST_Structure *fd = 0;

  if (d != 0)
    {
      // Full definition must have the same prefix as the forward declaration.
      if (ACE_OS::strcmp (i->prefix (), d->prefix ()) != 0)
        {
          idl_global->err ()->error1 (UTL_Error::EIDL_PREFIX_CONFLICT,
                                      i);

          return;
        }

      AST_Decl::NodeType nt = d->node_type ();

      // If this interface has been forward declared in a previous opening
      // of the module it's defined in, the lookup will find the
      // forward declaration.
      if (nt == AST_Decl::NT_struct_fwd
          || nt == AST_Decl::NT_union_fwd)
        {
          AST_StructureFwd *fwd_def =
            AST_StructureFwd::narrow_from_decl (d);

          fd = fwd_def->full_definition ();
        }
      // In all other cases, the lookup will find an interface node.
      else if (nt == AST_Decl::NT_struct
               || nt == AST_Decl::NT_union)
        {
          fd = AST_Structure::narrow_from_decl (d);
        }

      // Successful?
      if (fd == 0)
        {
          // Should we give an error here?
          // No, look in fe_add_interface.
        }
      // If it is a forward declared interface..
      else if (!fd->is_defined ())
        {
          // Check if redefining in same scope. If a module is reopened,
          // a new pointer in created, and the first term below will be
          // true. In that case, the scoped names must be compared.
          if (fd->defined_in () != s
              && i->name ()->compare (fd->name ()) != 0)
            {
              idl_global->err ()->error2 (UTL_Error::EIDL_SCOPE_CONFLICT,
                                          i,
                                          fd);
            }
          // All OK, do the redefinition.
          else
            {
              AST_Decl::NodeType fd_nt = fd->node_type ();
              AST_Decl::NodeType i_nt = i->node_type ();

              // Only redefinition of the same kind.
              if (i_nt != fd_nt)
                {
                  idl_global->err ()->error2 (UTL_Error::EIDL_REDEF,
                                              i,
                                              fd);
                  return;
                }

              fd->redefine (i);
              AST_StructureFwd *fwd = fd->fwd_decl ();

              if (0 != fwd)
                {
                  // So the fwd decl won't destroy us at cleanup time.
                  // Unlike interfaces, valuetypes and components, it's
                  // ok to do this here, since fwd declared structs
                  // and unions must be defined in the same translation
                  // unit.
                  fwd->set_as_defined ();
                }

              // Use full definition node.
              i->destroy ();
              delete i;
              i = fd;
            }
//.........这里部分代码省略.........
开发者ID:handsomett,项目名称:ATCD,代码行数:101,代码来源:ast_structure.cpp

示例7: if

/*
 * Add this AST_Value node (a value type declaration) to this scope
 */
AST_BoxedValue *AST_Module::fe_add_boxed_valuetype(AST_BoxedValue *v)
{
   AST_Decl *predef;
   AST_Interface *fwd;

   /*
    * Already defined?
    */

   if ((predef = lookup_for_add (v)) != NULL)
   {
      /*
       * Treat fwd declared interfaces specially
       */

      if (predef->node_type() == AST_Decl::NT_value)
      {
         fwd = AST_Value::narrow_from_decl(predef);

         if (fwd == NULL)
            return NULL;

         if (!fwd->is_defined())
         { /* Forward declared and not defined yet */

            if (fwd->defined_in() != this)
            {
               idl_global->err()
               ->error3(UTL_Error::EIDL_SCOPE_CONFLICT, fwd, v, this);
               return NULL;
            }
         }

         /*
          * OK, not illegal redef of forward declaration. Now check whether
          * it has been referenced already
          */
         else if (referenced(predef))
         {
            idl_global->err()->error3(UTL_Error::EIDL_DEF_USE, v, this, predef);
            return NULL;
         }
      }
      else if (!can_be_redefined(predef))
      {
         idl_global->err()->error3(UTL_Error::EIDL_REDEF, v, this, predef);
         return NULL;
      }
      else if (referenced(predef))
      {
         idl_global->err()->error3(UTL_Error::EIDL_DEF_USE, v, this, predef);
         return NULL;
      }
      else if (v->has_ancestor(predef))
      {
         idl_global->err()->redefinition_in_scope(v, predef);
         return NULL;
      }
   }

   /*
    * Add it to scope
    */
   add_to_scope(v);

   /*
    * Add it to set of locally referenced symbols
    */
   add_to_referenced(v, I_FALSE);

   return v;
}
开发者ID:S73417H,项目名称:opensplice,代码行数:75,代码来源:ast_module.cpp

示例8: ScopeAsDecl

typename FULL_DECL::FWD_TYPE *
UTL_Scope::fe_add_fwd_intf_decl (typename FULL_DECL::FWD_TYPE *t)
{
  AST_Decl *d = 0;

  // Already defined and cannot be redefined? Or already used?
  if ((d = this->lookup_for_add (t)) != 0)
    {
      AST_Decl::NodeType nt = d->node_type ();

      // There used to be another check here ANDed with the one below:
      // d->defined_in () == this. But lookup_for_add() calls only
      // lookup_by_name_local(), which does not bump up the scope,
      // and look_in_prev_mods() for modules. If look_in_prev_mods()
      // finds something, the scopes will NOT be the same pointer
      // value, but the result is what we want.
      if (nt == FULL_DECL::NT)
        {
          FULL_DECL *itf = FULL_DECL::narrow_from_decl (d);

          if (itf == 0)
            {
              return 0;
            }

          // If the lookup found the full_definition member of another
          // interface_fwd, don't reset this full_definition. Otherwise
          // reset the member and set is_defined_ on i so it itf won't
          // get destroyed twice.
          if (itf->is_defined ())
            {
              if (!t->is_defined ())
                {
                  FULL_DECL *prev_fd =
                    FULL_DECL::narrow_from_decl (t->full_definition ());

                  prev_fd->destroy ();
                  // No need to delete prev_fd, the call to
                  // set_full_definition() below will do it.
                }

              t->set_full_definition (itf);
              t->set_as_defined ();
            }
        }

      if (!FE_Utils::can_be_redefined (d, t)) {

          idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
                                      t,
                                      ScopeAsDecl (this),
                                      d);
          return 0;
        }

      // No need to call referenced() for forward declared interafces,
      // they can be redeclared after referencing.

      if (t->has_ancestor (d))
        {
          idl_global->err ()->redefinition_in_scope  (t, d);
          return 0;
        }
    }

  // Add it to scope
  this->add_to_scope (t);

  // Add it to set of locally referenced symbols
  this->add_to_referenced (t,
                           false,
                           t->local_name ());

  return t;
}
开发者ID:asdlei00,项目名称:ACE,代码行数:75,代码来源:utl_scope_T.cpp

示例9: if

DECL *
UTL_Scope::fe_add_full_intf_decl (DECL *t)
{
  if (t->redef_clash ())
    {
      return 0;
    }

  AST_Decl *predef = 0;
  DECL *fwd = 0;

  // Already defined?
  if ((predef = this->lookup_for_add (t)) != 0)
    {
      // Treat fwd declared interfaces specially
      if (predef->node_type () == DECL::NT)
        {
          fwd = DECL::narrow_from_decl (predef);

          if (fwd == 0)
            {
              return 0;
            }

          // Forward declared and not defined yet.
          if (!fwd->is_defined ())
            {
              if (fwd->defined_in () != this)
                {
                  idl_global->err ()->error3 (UTL_Error::EIDL_SCOPE_CONFLICT,
                                              fwd,
                                              t,
                                              ScopeAsDecl (this));

                  return 0;
                }
            }
          // OK, not illegal redef of forward declaration. Now check whether.
          // it has been referenced already.
          else if (this->referenced (predef, t->local_name ()))
            {
              idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
                                          t,
                                          ScopeAsDecl (this),
                                          predef);

              return 0;
            }

        }
      else if (!FE_Utils::can_be_redefined (predef, t))
        {
          idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
                                      t,
                                      ScopeAsDecl (this),
                                      predef);

          return 0;
        }
      else if (referenced (predef, t->local_name ()) && !t->is_defined ())
        {
          idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
                                      t,
                                      ScopeAsDecl (this),
                                      predef);

          return 0;
        }
      else if (t->has_ancestor (predef))
        {
          idl_global->err ()->redefinition_in_scope (t, predef);

          return 0;
        }
    }

  // Add it to scope
  this->add_to_scope (t);

  // We do this for interfaces, valuetypes and components in
  // a different place than we do for structs and unions,
  // since fwd declared structs and unions must be defined in
  // the same translation unit.
  AST_InterfaceFwd *fd = t->fwd_decl ();

  if (0 != fd)
    {
      fd->set_as_defined ();
    }

  // Add it to set of locally referenced symbols
  this->add_to_referenced (t,
                           false,
                           t->local_name ());
  return t;
}
开发者ID:asdlei00,项目名称:ACE,代码行数:96,代码来源:utl_scope_T.cpp

示例10: while

AST_Decl *UTL_Scope::call_add()
{
   AST_Decl *result = NULL;
   AST_Decl *decl;

   UTL_ScopeActiveIterator *i;
   UTL_Scope *scope;

   i = new UTL_ScopeActiveIterator(this, UTL_Scope::IK_decls);

   while (!(i->is_done()))
   {
      decl = i->item();
      scope = 0;

      switch (decl->node_type())
      {

      case AST_Decl::NT_argument:
         result = add_argument(AST_Argument::narrow_from_decl(decl));
         break;

      case AST_Decl::NT_array:
         result = add_array(AST_Array::narrow_from_decl(decl));
         break;

      case AST_Decl::NT_attr:
         result = add_attribute(AST_Attribute::narrow_from_decl(decl));
         break;

      case AST_Decl::NT_const:
         result = add_constant(AST_Constant::narrow_from_decl(decl));
         break;

      case AST_Decl::NT_enum:
         scope = AST_Enum::narrow_from_decl(decl);
         result = add_enum(AST_Enum::narrow_from_decl(decl));
         break;

      case AST_Decl::NT_enum_val:
         result = add_enum_val(AST_EnumVal::narrow_from_decl(decl));
         break;

      case AST_Decl::NT_except:
         scope = AST_Exception::narrow_from_decl(decl);
         result = add_exception(AST_Exception::narrow_from_decl(decl));
         break;

      case AST_Decl::NT_field:
         result = add_field(AST_Field::narrow_from_decl(decl));
         break;

      case AST_Decl::NT_interface:
         scope = AST_Interface::narrow_from_decl(decl);
         result = add_interface(AST_Interface::narrow_from_decl(decl));
         break;

      case AST_Decl::NT_interface_fwd:
         result = add_interface_fwd(AST_InterfaceFwd::narrow_from_decl(decl));
         break;

      case AST_Decl::NT_module:
         scope = AST_Module::narrow_from_decl(decl);
         result = add_module(AST_Module::narrow_from_decl(decl));
         break;

      case AST_Decl::NT_op:
         result = add_operation(AST_Operation::narrow_from_decl(decl));
         scope = AST_Operation::narrow_from_decl(decl);
         break;

      case AST_Decl::NT_pre_defined:
         result =
         add_predefined_type(AST_PredefinedType::narrow_from_decl(decl));
         break;

      case AST_Decl::NT_sequence:
         result = add_sequence(AST_Sequence::narrow_from_decl(decl));
         break;

      case AST_Decl::NT_string:
         result = add_string(AST_String::narrow_from_decl(decl));
         break;

      case AST_Decl::NT_struct:
         result = add_structure(AST_Structure::narrow_from_decl(decl));
         scope = AST_Structure::narrow_from_decl(decl);
         break;

      case AST_Decl::NT_typedef:
         result = add_typedef(AST_Typedef::narrow_from_decl(decl));
         break;

      case AST_Decl::NT_union:
         result = add_union(AST_Union::narrow_from_decl(decl));
         scope = AST_Union::narrow_from_decl(decl);
         break;

      case AST_Decl::NT_union_branch:
         result = add_union_branch(AST_UnionBranch::narrow_from_decl(decl));
//.........这里部分代码省略.........
开发者ID:S73417H,项目名称:opensplice,代码行数:101,代码来源:utl_scope.cpp

示例11: item_new_name

int
be_visitor_interface_sh::gen_abstract_ops_helper (
  be_interface *node,
  be_interface *base,
  TAO_OutStream *os)
{
  if (!base->is_abstract ())
    {
      return 0;
    }

  AST_Decl *d = 0;
  be_visitor_context ctx;
  ctx.stream (os);
  ctx.state (TAO_CodeGen::TAO_ROOT_SH);

  for (UTL_ScopeActiveIterator si (base, UTL_Scope::IK_decls);
       !si.is_done ();
       si.next ())
    {
      d = si.item ();

      if (d == 0)
        {
          ACE_ERROR_RETURN ((LM_ERROR,
                             ACE_TEXT ("be_visitor_interface_sh::")
                             ACE_TEXT ("gen_abstract_ops_helper - ")
                             ACE_TEXT ("bad node in this scope\n")),
                            -1);
        }

      UTL_ScopedName item_new_name (d->local_name (),
                                    0);

      if (d->node_type () == AST_Decl::NT_op)
        {
          be_operation *op = be_operation::narrow_from_decl (d);
          be_visitor_operation_sh op_visitor (&ctx);
          op_visitor.visit_operation (op);
        }
      else if (d->node_type () == AST_Decl::NT_attr)
        {
          AST_Attribute *attr = AST_Attribute::narrow_from_decl (d);
          be_attribute new_attr (attr->readonly (),
                                 attr->field_type (),
                                 &item_new_name,
                                 attr->is_local (),
                                 attr->is_abstract ());
          new_attr.set_defined_in (node);

          UTL_ExceptList *get_exceptions = attr->get_get_exceptions ();

          if (0 != get_exceptions)
            {
              new_attr.be_add_get_exceptions (get_exceptions->copy ());
            }

          UTL_ExceptList *set_exceptions = attr->get_set_exceptions ();

          if (0 != set_exceptions)
            {
              new_attr.be_add_set_exceptions (set_exceptions->copy ());
            }

          be_visitor_attribute attr_visitor (&ctx);
          attr_visitor.visit_attribute (&new_attr);
          ctx.attribute (0);
          new_attr.destroy ();
        }
    }

  return 0;
}
开发者ID:asdlei00,项目名称:ACE,代码行数:73,代码来源:interface_sh.cpp

示例12: if

/*
 * Look up a String * in local scope only
 */
AST_Decl * UTL_Scope::lookup_by_name_local (Identifier *e)
{
   UTL_ScopeListIterator si;
   // UTL_Scope * s;
   AST_Decl *d = NULL;

   if (DEBUG_SCOPES)
   {
      cout << "UTL_Scope::lookup_by_name_local(";

      if (e)
         e->dump(cout);
      else
         cout << "NAME_IS_NIL";

      cout << ") in ";

      if (pd_scoped_name)
         pd_scoped_name->dump(cout);
      else
         cout << "SCOPE_NAME_IS_NIL";

      cout << endl;
   }

   assert(pd_combined_scope);

   if (pd_combined_scope->pd_combined_decls && e)
   {
      AST_InterfaceFwd *fwd;
      AST_ValueFwd *vfwd;
      UtlMap<Identifier, AST_Decl*>::iterator iterDecl =
         pd_combined_scope->pd_combined_decls->find(*e);

      if (iterDecl.valid())
      {
         d = *iterDecl;

         if (d->node_type() == AST_Decl::NT_interface_fwd)
         {
            /*
             * Special case for forward declared interfaces. Look through the
             * forward declaration and retrieve the full definition
             */
            fwd = AST_InterfaceFwd::narrow_from_decl(d);

            if (fwd == NULL)
               d = NULL;
            else
               d = fwd->full_definition();
         }
         else if (d->node_type() == AST_Decl::NT_value_fwd)
         {
            /*
             * Special case for forward declared interfaces. Look through the
             * forward declaration and retrieve the full definition
             */
            vfwd = AST_ValueFwd::narrow_from_decl(d);

            if (vfwd == NULL)
               d = NULL;
            else
               d = vfwd->full_definition();
         }
      }
   }

   return d;
}
开发者ID:S73417H,项目名称:opensplice,代码行数:72,代码来源:utl_scope.cpp

示例13: gen_interf

bool idl_mapping_java::gen_interf(UTL_ScopedName *name, bool local,
                                  const std::vector<AST_Interface *> &inherits,
                                  const std::vector<AST_Interface *> &inherits_flat,
                                  const std::vector<AST_Attribute *> &attrs,
                                  const std::vector<AST_Operation *> &ops, const char *repoid)
{
  JavaName jn(name);
  JavaName jn_ops(jn, "Operations");
  JavaName jn_stub(jn, local ? "TAOPeer" : "Stub", true);

  string extends = jn.clazz_ + "Operations, "
                   + (inherits.size() ? "" : "org.omg.CORBA.Object");
  string extends_ops;

  for (size_t i = 0; i < inherits.size(); ++i) {
    extends += type(inherits[i]);
    extends_ops += type(inherits[i]) + "Operations";

    if (i != inherits.size() - 1) {
      extends += ", ";
      extends_ops += ", ";
    }
  }

  string extends_stub = string("i2jrt.TAO") +
                        (local ? "Local" : "") + "Object";

  string allRepoIds = '"' + string(repoid) + '"',
                      body_ops, body_stub =
                        "  protected " + jn_stub.clazz_ + "(long ptr) {\n"
                        "    super(ptr);\n"
                        "  }\n\n";

  for (size_t i = 0; i < attrs.size(); ++i) {
    AST_Attribute *attr = attrs[i];

    string signature = attr_signature_r(attr);
    body_ops +=
      "  " + signature + ";\n";
    body_stub +=
      "  public native " + signature + ";\n\n";

    if (!attr->readonly()) {
      string signature = attr_signature_w(attr);
      body_ops +=
        "  " + signature + ";\n";
      body_stub +=
        "  public native " + signature + ";\n\n";
    }
  }

  for (size_t i = 0; i < ops.size(); ++i) {
    string signature = op_signature(ops[i]);
    body_ops +=
      "  " + signature + ";\n";
    body_stub +=
      "  public native " + signature + ";\n\n";
  }

  for (size_t i = 0; i < inherits_flat.size(); ++i) {
    AST_Interface *base = inherits_flat[i];
    allRepoIds += ", \"" + string(base->repoID()) + '"';

    UTL_ScopeActiveIterator it(base, UTL_Scope::IK_decls);

    for (; !it.is_done(); it.next()) {
      AST_Decl *item = it.item();

      if (item->node_type() == AST_Decl::NT_attr) {
        AST_Attribute *attr = AST_Attribute::narrow_from_decl(item);

        string signature = attr_signature_r(attr);
        body_stub +=
          "  public native " + signature + ";\n\n";

        if (!attr->readonly()) {
          string signature = attr_signature_w(attr);
          body_stub +=
            "  public native " + signature + ";\n\n";
        }

      } else if (item->node_type() == AST_Decl::NT_op) {
        AST_Operation *op = AST_Operation::narrow_from_decl(item);
        body_stub +=
          "  public native " + op_signature(op) + ";\n\n";
      }
    }
  }

  bool ok(true);

  if (local) {
    JavaName jn_lb(jn, "LocalBase", true);
    string lb =
      "  private String[] _type_ids = {" + allRepoIds + "};\n\n"
      "  public String[] _ids() { return (String[])_type_ids.clone(); }\n";
    ok = java_class_gen(jn_lb, JABSTRACT_CLASS, lb.c_str(),
                        "org.omg.CORBA.LocalObject", jn.clazz_.c_str());
  }

//.........这里部分代码省略.........
开发者ID:AndroidDev77,项目名称:OpenDDS,代码行数:101,代码来源:im_java.cpp

示例14: switch

int
be_visitor_connector_dds_exh::visit_connector (be_connector *node)
{
  if (node->imported ())
    {
      return 0;
    }

  if (!this->begin (node))
    {
      return -1;
    }

  // If we have a connector within a templated module
  if (! this->t_args_.is_empty ())
    {
      // Generate all needed dds_traits
      for (FE_Utils::T_ARGLIST::CONST_ITERATOR i (this->t_args_);
          !i.done ();
          i.advance ())
        {
          AST_Decl **item = 0;
          i.next (item);
          AST_Decl *d = *item;

          if (this->is_dds_type (node, d))
            {
              this->gen_dds_traits (d);
            }
        }

      // Generate connector traits
      this->gen_connector_traits ();

      os_ << be_nl_2
          << "class " << this->export_macro_.c_str () << " "
          << this->node_->local_name () << "_exec_i" << be_idt_nl
          << ": public " << this->base_tname_ << "_Connector_T";

      os_ << " <" << be_idt << be_idt_nl;

      os_ << "CCM_" << this->node_->flat_name ()
          << "_Traits," << be_nl;

      size_t slot = 1UL;

      for (FE_Utils::T_ARGLIST::CONST_ITERATOR i (this->t_args_);
          !i.done ();
          i.advance (), ++slot)
        {
          AST_Decl **item = 0;
          i.next (item);
          AST_Decl *d = *item;

          if (this->is_dds_type (node, d))
            {
              os_ << d->flat_name ()
                  << "_DDS_Traits";
            }
          else
            {
              os_ << d->name ();
            }

          bool needs_bool = false;
          bool is_fixed = false;
          FE_Utils::T_Param_Info *param = 0;

          if (this->t_params_->get (param, slot - 1) != 0)
            {
              ACE_ERROR_RETURN ((LM_ERROR,
                                 ACE_TEXT ("be_visitor_connector_dds_exh::")
                                 ACE_TEXT ("visit_connector - ")
                                 ACE_TEXT ("template param fetch failed\n ")),
                                -1);
            }

          if (d->node_type () == AST_Decl::NT_typedef)
            {
              /// Strip away all layers of typedef before narrowing.
              AST_Typedef *td = AST_Typedef::narrow_from_decl (d);
              d = td->primitive_base_type ();
            }

          /// No need to check if this is 0, but must narrow
          /// to call virtual function size_type() below.
          AST_Type *t = AST_Type::narrow_from_decl (d);

          switch (param->type_)
            {
              case AST_Decl::NT_type:
              case AST_Decl::NT_struct:
              case AST_Decl::NT_union:
                needs_bool = true;
                is_fixed = (t->size_type () == AST_Type::FIXED);
                break;
              default:
                break;
            }

//.........这里部分代码省略.........
开发者ID:asdlei00,项目名称:ACE,代码行数:101,代码来源:connector_dds_exh.cpp

示例15: if

be_valuetype *
be_visitor_amh_pre_proc::create_exception_holder (be_interface *node)
{
  // AMH exception holders require both of these.
  idl_global->valuetype_seen_ = true;

  idl_global->valuefactory_seen_ = true;

  const int inherit_count = 0;
  AST_Type **p_intf = 0;

  UTL_ScopedName *excep_holder_name =
    node->compute_name ("AMH_",
                        "ExceptionHolder");

  UTL_Scope *s = node->defined_in ();
  idl_global->scopes ().push (s);

  be_valuetype *excep_holder = 0;
  ACE_NEW_RETURN (excep_holder,
                  be_valuetype (excep_holder_name,
                                p_intf,
                                inherit_count,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0,
                                0),
                  0);

  idl_global->scopes ().pop ();

  excep_holder->set_name (excep_holder_name);
  excep_holder->set_defined_in (node->defined_in ());

  // Set repo id to 0, so it will be recomputed on the next access,
  // and set the prefix to the node's prefix. All this is
  // necessary in case the node's prefix was modified after
  // its declaration.
  excep_holder->AST_Decl::repoID (0);
  excep_holder->prefix (const_cast<char*> (node->prefix ()));

  excep_holder->gen_fwd_helper_name ();

  // Now our customized valuetype is created, we have to
  // add now the operations and attributes to the scope.

  // initialize an iterator to iterate thru our scope
  for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
       !si.is_done ();
       si.next ())
    {
      AST_Decl *d = si.item ();

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

      be_decl *op = be_decl::narrow_from_decl (d);
      AST_Decl::NodeType nt = d->node_type ();

      if (nt == AST_Decl::NT_attr)
        {
          AST_Attribute *attribute = AST_Attribute::narrow_from_decl (d);

          if (attribute == 0)
            {
              return 0;
            }

          this->create_raise_operation (op,
                                        excep_holder,
                                        GET_OPERATION);

          if (!attribute->readonly ())
            {
              this->create_raise_operation (op,
                                            excep_holder,
                                            SET_OPERATION);
            }
        }
      else if (nt == AST_Decl::NT_op)
        {
          this->create_raise_operation (op,
                                        excep_holder,
                                        NORMAL);
        }
      else
        {
          continue;
        }
//.........这里部分代码省略.........
开发者ID:DOCGroup,项目名称:ACE_TAO,代码行数:101,代码来源:be_visitor_amh_pre_proc.cpp


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