您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ AST_Type类代码示例

51自学网 2021-06-03 12:04:23
  C++
这篇教程C++ AST_Type类代码示例写得很实用,希望能帮到您。

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

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

示例1:

// Compute the size type of the node in question.intAST_Structure::compute_size_type (void){  for (UTL_ScopeActiveIterator si (this, UTL_Scope::IK_decls);       !si.is_done ();       si.next ())    {      // Get the next AST decl node.      AST_Decl *d = si.item ();      if (d->node_type () == AST_Decl::NT_enum_val)        {          continue;        }      AST_Field *f = AST_Field::narrow_from_decl (d);      AST_Type *t = f->field_type ();      if (t != 0)        {          this->size_type (t->size_type ());          // While we're iterating, we might as well do this one too.          this->has_constructor (t->has_constructor ());        }      else        {          ACE_DEBUG ((LM_DEBUG,                      "WARNING (%N:%l) be_structure::compute_size_type - "                      "narrow_from_decl returned 0/n"));        }    }  return 0;}
开发者ID:handsomett,项目名称:ATCD,代码行数:36,


示例2:

intbe_visitor_event_source_desc::visit_publishes (  be_publishes *node){  AST_Type *obj = node->publishes_type ();  const char *port_name =    node->local_name ()->get_string ();  os_ << be_nl_2;  os_ << "{" << be_idt_nl      << "ACE_GUARD_RETURN (TAO_SYNCH_MUTEX," << be_nl      << "                  mon," << be_nl      << "                  this->context_->"      << port_name << "_lock_," << be_nl      << "                  0);" << be_nl_2;  os_ << "::CIAO::Servant::describe_pub_event_source<"      << be_idt_nl      << "::" << obj->full_name () << "Consumer_var> ("      << be_idt_nl      << "/"" << port_name << "/"," << be_nl      << "/"" << obj->repoID () << "/"," << be_nl      << "this->context_->ciao_publishes_"      << port_name << "_," << be_nl      << "safe_retval," << be_nl      << slot_++ << "UL);" << be_uidt << be_uidt;  os_ << be_uidt_nl      << "}";  return 0;}
开发者ID:DOCGroup,项目名称:ACE_TAO,代码行数:33,


示例3:

voidbe_component::gen_skel_inheritance (TAO_OutStream *os){  AST_Component *base = this->base_component ();  if (base != 0)    {      *os << "public virtual POA_" << base->name ();    }  else    {      *os << "public virtual POA_Components::CCMObject";    }  long nsupports = this->n_inherits ();  AST_Type **supports = this->supports ();  AST_Type *supported = 0;  for (long i = 0; i < nsupports; ++i)    {      supported = supports[i];      if (supported->is_abstract ())        {          continue;        }      *os << "," << be_nl;      *os << "public virtual POA_" << supported->name ();    }}
开发者ID:asdlei00,项目名称:ACE,代码行数:31,


示例4: AST_Decl

be_argument::be_argument(   AST_Argument::Direction d,   AST_Type *ft,   UTL_ScopedName *n,   const UTL_Pragmas &p):   AST_Decl (AST_Decl::NT_argument, n, p),   AST_Field (AST_Decl::NT_argument, ft, n, p),   AST_Argument (d, ft, n, p),   m_beType (0),   m_direction (d){   AST_Type * at = field_type();   be_Type * bt;   if (at && (bt = (be_Type*)at->narrow((long) & be_Type::type_id)))   {      const char * typeName = bt->TypeName ();      if (typeName && strcmp (typeName, "DDS::Any") == 0)      {         BE_Globals::inc_any = pbtrue;      }   }}
开发者ID:xrl,项目名称:opensplice_dds,代码行数:26,


示例5:

UTL_NameList *ast_visitor_tmpl_module_inst::create_name_list (AST_Type **list,                                               long length){  UTL_NameList *retval = 0;  for (long i = 0; i < length; ++i)    {      AST_Type *item =        AST_Type::narrow_from_decl (this->reify_type (list[i]));      // We copy each name added so we can call destroy() on the      // list, which disposes of the contents as well as the      // nested tail pointers.      UTL_NameList *name_item = 0;      ACE_NEW_RETURN (name_item,                      UTL_NameList (item->name ()->copy (), 0),                      0);      if (retval == 0)        {          retval = name_item;        }      else        {          retval->nconc (name_item);        }    }  return retval;}
开发者ID:asdlei00,项目名称:ACE,代码行数:31,


示例6:

// Compute total number of members.intAST_Operation::compute_argument_attr (void){  if (this->argument_count_ != -1)    {      return 0;    }  AST_Decl *d = 0;  AST_Type *type = 0;  AST_Argument *arg = 0;  this->argument_count_ = 0;  // If there are elements in this scope.  if (this->nmembers () > 0)    {      // Instantiate a scope iterator.      for (UTL_ScopeActiveIterator si (this, UTL_Scope::IK_decls);           !si.is_done ();           si.next ())        {          // Get the next AST decl node.          d = si.item ();          if (d->node_type () == AST_Decl::NT_argument)            {              this->argument_count_++;              arg = AST_Argument::narrow_from_decl (d);              if (arg->direction() == AST_Argument::dir_IN ||                  arg->direction() == AST_Argument::dir_INOUT)                {                  this->has_in_arguments_ = true;                }              type = AST_Type::narrow_from_decl (arg->field_type ());              if (type->node_type () == AST_Decl::NT_native)                {                  this->has_native_ = 1;                }            }        }    }  type = AST_Type::narrow_from_decl (this->return_type ());  if (type->node_type () == AST_Decl::NT_native)    {      this->has_native_ = 1;    }  return 0;}
开发者ID:CCJY,项目名称:ATCD,代码行数:58,


示例7: return

boolAST_Operation::void_return_type (void){  AST_Type* type = this->return_type ();  return (type->node_type () == AST_Decl::NT_pre_defined          && (AST_PredefinedType::narrow_from_decl (type)->pt ()                == AST_PredefinedType::PT_void));}
开发者ID:CCJY,项目名称:ATCD,代码行数:9,


示例8: field_type

void be_argument::Initialize (){   AST_Type * at = field_type();   be_Type * bt;   if (at && (bt = (be_Type*)at->narrow((long) & be_Type::type_id)))   {      bt->Initialize ();   }}
开发者ID:xrl,项目名称:opensplice_dds,代码行数:10,


示例9: prefix

intbe_visitor_receptacle_desc::visit_uses (be_uses *node){  ACE_CString prefix (this->ctx_->port_prefix ());  prefix += node->local_name ()->get_string ();  const char *port_name = prefix.c_str ();  AST_Type *obj = node->uses_type ();  bool const is_multiple = node->is_multiple ();  os_ << be_nl_2;  ACE_CString sname_str (comp_->full_name ());  const char *sname = sname_str.c_str ();  const char *global = (sname_str == "" ? "" : "::");  if (!is_multiple)    {      os_ << obj->full_name () << "_var ciao_"          << port_name << " = " << be_idt_nl          << "this->context_->get_connection_"          << port_name << " ();" << be_uidt_nl;    }  else    {      os_ << "::" << sname << global << port_name << "Connections_var ciao_"          << port_name << " = " << be_idt_nl          << "this->context_->get_connections_"          << port_name << " ();" << be_uidt_nl;    }  os_ << "::CIAO::Servant::describe_"      << (is_multiple ? "multiplex" : "simplex")      << "_receptacle<" << be_idt_nl;  if (!is_multiple)    {      os_ << "::" << obj->full_name () << "> (" << be_idt_nl;    }  else    {      os_ << "::" << sname << global << port_name << "Connections> (" << be_idt_nl;    }  os_ << "/"" << port_name << "/"," << be_nl      << "/"" << obj->repoID () << "/"," << be_nl;  os_  << "ciao_" << port_name << ".in ()," << be_nl;  os_ << "safe_retval," << be_nl      << slot_++ << "UL);" << be_uidt << be_uidt;  return 0;}
开发者ID:DOCGroup,项目名称:ACE_TAO,代码行数:55,


示例10: ACE_ERROR_RETURN

intast_visitor_reifying::visit_sequence (AST_Sequence *node){  AST_Type *bt = node->base_type ();  if (bt->ast_accept (this) != 0)    {      ACE_ERROR_RETURN ((LM_ERROR,                         ACE_TEXT ("ast_visitor_reifying::")                         ACE_TEXT ("visit_sequence - ")                         ACE_TEXT ("visit of base type failed/n")),                        -1);    }  bt = AST_Type::narrow_from_decl (this->reified_node_);  AST_Expression *v = node->max_size ();  AST_Param_Holder *ph = v->param_holder ();  if (ph != 0)    {      if (this->visit_param_holder (ph) != 0)        {          ACE_ERROR_RETURN ((LM_ERROR,                             ACE_TEXT ("ast_visitor_reifying::")                             ACE_TEXT ("visit_sequence - ")                             ACE_TEXT ("visit_param_holder() ")                             ACE_TEXT ("failed/n")),                            -1);        }      AST_Constant *c =        AST_Constant::narrow_from_decl (this->reified_node_);      v = c->constant_value ();    }  AST_Expression *bound =    idl_global->gen ()->create_expr (v,                                     AST_Expression::EV_ulong);  Identifier id ("sequence");  UTL_ScopedName sn (&id, 0);  this->reified_node_ =    idl_global->gen ()->create_sequence (bound,                                         bt,                                         &sn,                                         false,                                         false);  // No need to add this new node to any scope - it's anonymous  // and owned by the node that references it.  return 0;}
开发者ID:CCJY,项目名称:ATCD,代码行数:55,


示例11: AST_Decl

be_typedef::be_typedef (AST_Type *bt, UTL_ScopedName *n, const UTL_Pragmas &p):   AST_Decl (AST_Decl::NT_typedef, n, p),   AST_Typedef (bt, n, p),   m_generateBase (FALSE),   m_generated (FALSE),   m_baseBeType (0){   AST_Type* astType = base_type();   be_array* ba;   be_sequence* bs;   localName = local_name()->get_string();   enclosingScope = be_Type::EnclosingScopeString(this);   m_baseBeType = get_base_be_type();   //   // make sure the base type has a name (if anonymous)   //   bs = (be_sequence*)astType->narrow((long) & be_sequence::type_id);   if (bs)   {      m_generateBase = bs->SetName(enclosingScope, localName);   }   else if ((ba = (be_array*)astType->narrow((long) & be_array::type_id)))   {      m_generateBase = ba->SetName(enclosingScope, localName);   }   //   // now initialize the base's type and typemap   //   m_baseBeType->Initialize();   m_baseBeType->HasTypeDef (pbtrue);   InitializeTypeMap (this);   m_typecode = m_baseBeType->m_typecode;   m_typecode->id = get_decl_pragmas().get_repositoryID()->get_string();   m_typecode->name_of_type = localName;   DDS_StdString scopedname = NoColons(enclosingScope + "_" + localName);   TypeCodeTypeName(BE_Globals::TCPrefix + localName);   MetaTypeTypeName(BE_Globals::MTPrefix + scopedname);   TypeCodeRepName(BE_Globals::TCRepPrefix + scopedname);   TypeCodeBaseName(BE_Globals::TCBasePrefix + scopedname);}
开发者ID:S73417H,项目名称:opensplice,代码行数:53,


示例12: assert

be_Type*be_argument::BeType() const{   be_Type * ret = 0;   AST_Type* atype = ((be_argument*)this)->field_type();   if (atype)   {      ret = (be_Type*)atype->narrow((long) & be_Type::type_id);      assert(ret);   }   return ret;}
开发者ID:xrl,项目名称:opensplice_dds,代码行数:14,


示例13: while

AST_Type *be_typedef::_astBase(AST_Type * ttype){   AST_Type * ret = ttype;   if (ret)   {      AST_Typedef * atd;      while ((atd = (AST_Typedef*)ret->narrow((long) & AST_Typedef::type_id)))      {         ret = atd->base_type();      }   }   return ret;}
开发者ID:S73417H,项目名称:opensplice,代码行数:17,


示例14: if

intbe_visitor_array::visit_typedef (be_typedef *node){  TAO_OutStream *os = this->ctx_->stream ();  AST_Type *pbt = node->primitive_base_type ();  AST_Decl::NodeType nt = pbt->node_type ();  AST_PredefinedType::PredefinedType pt = AST_PredefinedType:: PT_void;  int result = 0;  // We check for these first, because in these cases, we replace the  // entire slice type with one of the strings below, instead of using  // the node's type name, possibly suffixed with '_var'.  if (nt == AST_Decl::NT_string)    {      *os << "::TAO::String_Manager";      return 0;    }  else if (nt == AST_Decl::NT_wstring)    {      *os << "::TAO::WString_Manager";      return 0;    }  result = this->visit_node (node);  if (nt == AST_Decl::NT_pre_defined)    {      AST_PredefinedType *pdt = AST_PredefinedType::narrow_from_decl (pbt);      pt = pdt->pt ();    }  // We must append a "_var" for typedefs of interfaces, CORBA::Objects or  // typecodes.  if (nt == AST_Decl::NT_interface      || nt == AST_Decl::NT_interface_fwd      || pt == AST_PredefinedType::PT_pseudo      || pt == AST_PredefinedType::PT_object)    {      *os << "_var";    }  return result;}
开发者ID:DOCGroup,项目名称:ACE_TAO,代码行数:45,


示例15:

// Compute total number of members.intAST_Factory::compute_argument_attr (void){  if (this->argument_count_ != -1)    {      return 0;    }  AST_Decl *d = 0;  AST_Type *type = 0;  AST_Argument *arg = 0;  this->argument_count_ = 0;  // If there are elements in this scope.  if (this->nmembers () > 0)    {      for (UTL_ScopeActiveIterator i (this, IK_decls);           !i.is_done ();           i.next ())        {          // Get the next AST decl node.          d = i.item ();          if (d->node_type () == AST_Decl::NT_argument)            {              this->argument_count_++;              arg = AST_Argument::narrow_from_decl (d);              type = AST_Type::narrow_from_decl (arg->field_type ());              if (type->node_type () == AST_Decl::NT_native)                {                  this->has_native_ = 1;                }            }        }    }  return 0;}
开发者ID:CCJY,项目名称:ATCD,代码行数:43,


示例16: if

DDS_StdStringbe_typedef::Initializer(const DDS_StdString& var, VarType vt) const{   AST_Type * basetype = ((be_typedef*)this)->base_type();   be_enum * basetype_enum = 0;   be_Type * type;   DDS_StdString ret;   assert(basetype && basetype->narrow((long)&be_Type::type_id));   // This conditional statement here is kludgy.  See comment   basetype_enum = (be_enum*)basetype->narrow((long) & be_enum::type_id);   if (basetype_enum)   {      ret = var + " = (" + typeName + ")0;";   }   else if ((basetype && (type = (be_Type*)basetype->narrow((long) & be_Type::type_id))))   {      ret = type->Initializer(var, vt);   }   return ret;}
开发者ID:S73417H,项目名称:opensplice,代码行数:24,


示例17:

// Compute the size type of the node in question.intAST_Union::compute_size_type (void){  for (UTL_ScopeActiveIterator si (this, UTL_Scope::IK_decls);       !si.is_done ();       si.next ())    {      // Get the next AST decl node.      AST_Decl *d = si.item ();      if (d->node_type () == AST_Decl::NT_enum_val)        {          continue;        }      AST_Field *f = AST_Field::narrow_from_decl (d);      if (f != 0)        {          AST_Type *t = f->field_type ();          // Our sizetype depends on the sizetype of our members. Although          // previous value of sizetype may get overwritten, we are          // guaranteed by the "size_type" call that once the value reached          // be_decl::VARIABLE, nothing else can overwrite it.          this->size_type (t->size_type ());        }      else        {          ACE_DEBUG ((LM_DEBUG,                      "WARNING (%N:%l) be_union::compute_size_type - "                      "narrow_from_decl returned 0/n"));        }    }  return 0;}
开发者ID:CCJY,项目名称:ATCD,代码行数:37,


示例18: return

// Are we or the parameter node involved in any recursion?boolAST_Exception::in_recursion (ACE_Unbounded_Queue<AST_Type *> &list){  bool self_test = (list.size () == 0);  // We should calculate this only once. If it has already been  // done, just return it.  if (self_test && this->in_recursion_ != -1)    {      return (this->in_recursion_ == 1);    }  if (list.size () > 1)  {    if (match_names (this, list))      {        // this happens when we are not recursed ourselves but instead        // are part of another recursive type        return false;      }  }  list.enqueue_tail(this);  // Proceed if the number of members in our scope is greater than 0.  if (this->nmembers () > 0)    {      // Continue until each element is visited.      for (UTL_ScopeActiveIterator i (this, IK_decls);!i.is_done ();i.next ())        {          AST_Field *field = AST_Field::narrow_from_decl (i.item ());          if (field == 0)            // This will be an enum value or other legitimate non-field            // member - in any case, no recursion.            {              continue;            }          AST_Type *type = field->field_type ();          if (type->node_type () == AST_Decl::NT_typedef)            {              AST_Typedef *td = AST_Typedef::narrow_from_decl (type);              type = td->primitive_base_type ();            }          if (type == 0)            {              ACE_ERROR_RETURN ((LM_ERROR,                                 ACE_TEXT ("(%N:%l) AST_Exception::")                                 ACE_TEXT ("in_recursion - ")                                 ACE_TEXT ("bad field type/n")),                                0);            }          if (type->in_recursion (list))            {              if (self_test)                this->in_recursion_ = 1;              idl_global->recursive_type_seen_ = true;              return true;            }        }    }  // Not in recursion.  if (self_test)    this->in_recursion_ = 0;  return 0; //this->in_recursion_;}
开发者ID:CCJY,项目名称:ATCD,代码行数:72,


示例19: ORBSVCS_ERROR_RETURN

// Specialized visit_scope method for stucts only.intifr_adding_visitor_structure::visit_scope (UTL_Scope *node){    // If the struct has members that are scopes but not structs,    // the regular visit_scope method should be called instead.    if (node->scope_node_type () != AST_Decl::NT_struct)    {        return ifr_adding_visitor::visit_scope (node);    }    AST_Structure *s = AST_Structure::narrow_from_scope (node);    CORBA::ULong nfields = static_cast<CORBA::ULong> (s->nfields ());    this->members_.length (nfields);    AST_Field **f = 0;    try    {        // Visit each field.        for (CORBA::ULong i = 0; i < nfields; ++i)        {            if (s->field (f, i) != 0)            {                ORBSVCS_ERROR_RETURN ((                                          LM_ERROR,                                          ACE_TEXT ("(%N:%l) ifr_adding_visitor_structure::")                                          ACE_TEXT ("visit_scope -")                                          ACE_TEXT (" field node access failed/n")),                                      -1);            }            AST_Type *ft = (*f)->field_type ();            bool defined_here = ft->is_child (this->scope_);            // If the struct member is defined in the struct, we have to            // do some visiting - otherwise we can just look up the entry.            if (defined_here)            {                if (ft->node_type () == AST_Decl::NT_struct)                {                    // Since the enclosing scope hasn't been created yet,                    // we make a special visitor to create this member                    // at global scope and move it into the struct later.                    ifr_adding_visitor_structure visitor (ft);                    if (ft->ast_accept (&visitor) == -1)                    {                        ORBSVCS_ERROR_RETURN ((                                                  LM_ERROR,                                                  ACE_TEXT ("(%N:%l) ifr_adding_visitor_structure::")                                                  ACE_TEXT ("visit_scope -")                                                  ACE_TEXT (" failed to accept visitor/n")),                                              -1);                    }                    this->ir_current_ =                        CORBA::IDLType::_duplicate (visitor.ir_current ());                }                else                {                    if (ft->ast_accept (this) == -1)                    {                        ORBSVCS_ERROR_RETURN ((                                                  LM_ERROR,                                                  ACE_TEXT ("(%N:%l) ifr_adding_visitor_structure::")                                                  ACE_TEXT ("visit_scope -")                                                  ACE_TEXT (" failed to accept visitor/n")),                                              -1);                    }                }            }            else            {                // Updates ir_current_.                this->get_referenced_type (ft);            }            this->members_[i].name =                CORBA::string_dup ((*f)->local_name ()->get_string ());            // IfR method create_struct does not use this - it just needs            // to be non-zero for marshaling.            this->members_[i].type =                CORBA::TypeCode::_duplicate (CORBA::_tc_void);            this->members_[i].type_def =                CORBA::IDLType::_duplicate (this->ir_current_.in ());        }    }    catch (const CORBA::Exception& ex)    {        ex._tao_print_exception (            ACE_TEXT (                "ifr_adding_visitor_structure::visit_scope"));        return -1;    }    return 0;}
开发者ID:akostrikov,项目名称:ATCD,代码行数:100,


示例20: ScopeAsDecl

intbe_visitor_home_svs::gen_servant_class (void){  AST_Decl *scope = ScopeAsDecl (node_->defined_in ());  ACE_CString sname_str (scope->full_name ());  const char *sname = sname_str.c_str ();  // Avoid '_cxx_' prefix.  const char *lname =    node_->original_local_name ()->get_string ();  const char *clname = comp_->local_name ()->get_string ();  const char *global = (sname_str == "" ? "" : "::");  os_ << be_nl      << lname << "_Servant::"      << lname << "_Servant (" << be_idt << be_idt_nl      << global << sname << "::CCM_" << lname << "_ptr exe," << be_nl      << "const char * ins_name," << be_nl      << "::CIAO::" << be_global->ciao_container_type ()      << "_Container_ptr c)" << be_uidt_nl      << ": ::CIAO::Home_Servant_Impl_Base ()," << be_idt_nl      << "::CIAO::"      << "Home_Servant_Impl<" << be_idt_nl      << "::" << node_->full_skel_name () << "," << be_nl      << global << sname << "::CCM_" << lname << "," << be_nl      << clname << "_Servant," << be_nl      << "::CIAO::" << be_global->ciao_container_type () << "_Container> (exe, c, ins_name)"      << be_uidt << be_uidt << be_uidt_nl      << "{" << be_nl      << "}";  os_ << be_nl_2      << lname << "_Servant::~" << lname << "_Servant (void)"      << be_nl      << "{" << be_nl      << "}";  if (this->node_->has_rw_attributes ())    {      os_ << be_nl_2          << "void" << be_nl          << lname << "_Servant::set_attributes (" << be_idt_nl          << "const ::Components::ConfigValues & descr)"          << be_uidt_nl          << "{" << be_idt_nl;      os_ << "for ( ::CORBA::ULong i = 0; i < descr.length (); ++i)"          << be_idt_nl          << "{" << be_idt_nl          << "const char * descr_name = descr[i]->name ();"          << be_nl          << "::CORBA::Any & descr_value = descr[i]->value ();";      be_visitor_home_attr_set as_visitor (this->ctx_);      if (as_visitor.visit_home (node_) == -1)        {          ACE_ERROR_RETURN ((LM_ERROR,                             "home_svs::"                             "gen_servant_class - "                             "attr init visitor failed/n"),                            -1);        }      os_ << be_uidt_nl          << "}" << be_uidt << be_uidt_nl          << "}";    }  AST_Type *pk = node_->primary_key ();  if (pk != 0)    {      os_ << be_nl_2          << "::" << comp_->name () << "_ptr" << be_nl          << lname << "_Servant::create (" << be_idt_nl          << "::" << pk->name () << " * /* key */)" << be_uidt_nl          << "{" << be_idt_nl          << "throw ::CORBA::NO_IMPLEMENT (CORBA::OMGVMCID | 8,"          << be_nl          << "                             CORBA::COMPLETED_NO);"          << be_uidt_nl          << "}";      if (!be_global->gen_lwccm ())        {          os_ << be_nl_2              << "::" << comp_->name () << "_ptr" << be_nl              << lname << "_Servant::find_by_primary_key (" << be_idt_nl              << "::" << pk->name () << " * /* key */)" << be_uidt_nl              << "{" << be_idt_nl              << "throw ::CORBA::NO_IMPLEMENT (CORBA::OMGVMCID | 8,"              << be_nl              << "                             CORBA::COMPLETED_NO);"              << be_uidt_nl              << "}";        }      os_ << be_nl_2//.........这里部分代码省略.........
开发者ID:CCJY,项目名称:ATCD,代码行数:101,


示例21: is_local_type

bool be_CodeGenerator::is_local_type (AST_Decl * d){   AST_Type* ast = (AST_Type*)d->narrow((long) & AST_Type::type_id);   return ast && ast->local();}
开发者ID:xrl,项目名称:opensplice_dds,代码行数:5,


示例22: classify

boolmetaclass_generator::gen_typedef(AST_Typedef*, UTL_ScopedName* name, AST_Type* type, const char*){  AST_Array* arr = AST_Array::narrow_from_decl(type);  AST_Sequence* seq = 0;  if (!arr && !(seq = AST_Sequence::narrow_from_decl(type))) {    return true;  }  const Classification cls = classify(type);  const std::string clazz = scoped(name);  ContentSubscriptionGuard csg;  NamespaceGuard ng;  Function f("gen_skip_over", "bool");  f.addArg("ser", "Serializer&");  f.addArg("", clazz + ((cls & CL_ARRAY) ? "_forany*" : "*"));  f.endArgs();  std::string len;  AST_Type* elem;  if (arr) {    elem = arr->base_type();    size_t n_elems = 1;    for (size_t i = 0; i < arr->n_dims(); ++i) {      n_elems *= arr->dims()[i]->ev()->u.ulval;    }    std::ostringstream strstream;    strstream << n_elems;    len = strstream.str();  } else { // Sequence    elem = seq->base_type();    be_global->impl_ <<      "  ACE_CDR::ULong length;/n"      "  if (!(ser >> length)) return false;/n";    len = "length";  }  const std::string cxx_elem = scoped(elem->name());  elem = resolveActualType(elem);  const Classification elem_cls = classify(elem);  if ((elem_cls & (CL_PRIMITIVE | CL_ENUM)) && !(elem_cls & CL_WIDE)) {    // fixed-length sequence/array element -> skip all elements at once    int sz = 1;    to_cxx_type(elem, sz);    be_global->impl_ <<      "  return ser.skip(" << len << ", " << sz << ");/n";  } else {    be_global->impl_ <<      "  for (ACE_CDR::ULong i = 0; i < " << len << "; ++i) {/n";    if ((elem_cls & CL_PRIMITIVE) && (elem_cls & CL_WIDE)) {      be_global->impl_ <<        "    ACE_CDR::Octet o;/n"        "    if (!(ser >> ACE_InputCDR::to_octet(o))) return false;/n"        "    if (!ser.skip(o)) return false;/n";    } else if (elem_cls & CL_STRING) {      be_global->impl_ <<        "    ACE_CDR::ULong strlength;/n"        "    if (!(ser >> strlength)) return false;/n"        "    if (!ser.skip(strlength)) return false;/n";    } else if (elem_cls & (CL_ARRAY | CL_SEQUENCE | CL_STRUCTURE)) {      be_global->impl_ <<        "    if (!gen_skip_over(ser, static_cast<" << cxx_elem <<        ((elem_cls & CL_ARRAY) ? "_forany" : "") << "*>(0))) return false;/n";    }    be_global->impl_ <<      "  }/n";    be_global->impl_ <<      "  return true;/n";  }  return true;}
开发者ID:oschwaldp-oci,项目名称:OpenDDS,代码行数:74,


示例23: if

// Dump this AST_Operation node (an operation) to the ostream o.voidAST_Operation::dump (ACE_OSTREAM_TYPE &o){  AST_Decl *d = 0;  AST_Type *e = 0;  UTL_String *s = 0;  if (this->pd_flags == OP_oneway)    {      this->dump_i (o, "oneway ");    }  else if (this->pd_flags == OP_idempotent)    {      this->dump_i (o, "idempotent ");    }  this->pd_return_type->name ()->dump (o);  this->dump_i (o, " ");  this->local_name ()->dump (o);  this->dump_i (o, "(");  // Must advance the iterator explicity inside the loop.  for (UTL_ScopeActiveIterator i (this, IK_decls); !i.is_done ();)    {      d = i.item ();      d->dump (o);      i.next ();      if (!i.is_done())        {          this->dump_i (o, ", ");        }    }  this->dump_i (o, ")");  if (this->pd_exceptions != 0)    {      this->dump_i (o, " raises(");      // Must advance the iterator explicity inside the loop.      for (UTL_ExceptlistActiveIterator ei (this->pd_exceptions);           !ei.is_done ();)        {          e = ei.item ();          ei.next ();          e->local_name ()->dump (o);          if (!ei.is_done())            {             this->dump_i (o, ", ");            }        }      this->dump_i (o, ")");    }  if (this->pd_context != 0)    {      this->dump_i (o, " context(");      // Must advance the iterator explicity inside the loop.      for (UTL_StrlistActiveIterator si (this->pd_context); !si.is_done();)        {          s = si.item ();          si.next ();          this->dump_i (o, s->get_string ());          if (!si.is_done())            {              this->dump_i (o, ", ");            }        }      this->dump_i (o, ")");    }}
开发者ID:CCJY,项目名称:ATCD,代码行数:78,


示例24: ScopeAsDecl

intbe_visitor_home_svh::gen_servant_class (void){  AST_Decl *scope = ScopeAsDecl (node_->defined_in ());  ACE_CString sname_str (scope->full_name ());  const char *sname = sname_str.c_str ();  // No '_cxx_' prefix.  const char *lname =    node_->original_local_name ()->get_string ();  const char *clname = comp_->local_name ()->get_string ();  const char *global = (sname_str == "" ? "" : "::");  os_ << be_nl      << "class " << export_macro_.c_str () << " " << lname      << "_Servant" << be_idt_nl      << ": public virtual" << be_idt << be_idt_nl      << "::CIAO::"      << "Home_Servant_Impl<" << be_idt_nl      << "::" << node_->full_skel_name () << "," << be_nl      << global << sname << "::CCM_" << lname << "," << be_nl      << clname << "_Servant," << be_nl      << "::CIAO::" << be_global->ciao_container_type () << "_Container>"      << be_uidt << be_uidt << be_uidt << be_uidt_nl      << "{" << be_nl      << "public:" << be_idt_nl;  os_ << lname << "_Servant (" << be_idt_nl      << global << sname << "::CCM_" << lname << "_ptr exe," << be_nl      << "const char * ins_name," << be_nl      << "::CIAO::" << be_global->ciao_container_type ()      << "_Container_ptr c);" << be_uidt;  os_ << be_nl_2      << "virtual ~" << lname << "_Servant (void);";  if (this->node_->has_rw_attributes ())    {      os_ << be_nl_2          << "virtual void" << be_nl          << "set_attributes (const "          << "::Components::ConfigValues & descr);";    }AST_Type *pk = node_->primary_key ();  if (pk != 0)    {      os_ << be_nl_2          << "// Implicit home primary key operations - not supported.";      os_ << be_nl_2          << "virtual ::" << comp_->name () << "_ptr" << be_nl          << "create (" << be_idt_nl          << "::" << pk->name () << " * key);" << be_uidt;      if (!be_global->gen_lwccm ())        {          os_ << be_nl_2              << "virtual ::" << comp_->name () << "_ptr" << be_nl              << "find_by_primary_key (" << be_idt_nl              << "::" << pk->name () << " * key);" << be_uidt;        }      os_ << be_nl_2          << "virtual void" << be_nl          << "remove (" << be_idt_nl          << "::" << pk->name () << " * key);" << be_uidt;      if (!be_global->gen_lwccm ())        {          os_ << be_nl_2              << "virtual ::" << pk->name () << " *" << be_nl              << "get_primary_key (" << be_idt_nl              << "::" << comp_->name () << "_ptr comp);" << be_uidt;        }    }  be_home *h = node_;  while (h != 0)    {      if (this->visit_scope (h) != 0)        {          ACE_ERROR_RETURN ((LM_ERROR,                             ACE_TEXT ("be_visitor_home_svh::")                             ACE_TEXT ("gen_servant_class - ")                             ACE_TEXT ("visit_scope() failed/n")),                            -1);        }      for (long i = 0; i < h->n_inherits (); ++i)        {          // A closure of all the supported interfaces is stored          // in the base class 'pd_inherits_flat' member.          be_interface *bi =            be_interface::narrow_from_decl (h->inherits ()[i]);          int status =//.........这里部分代码省略.........
开发者ID:asdlei00,项目名称:ACE,代码行数:101,


示例25: comp_sname_str

intbe_visitor_servant_svs::visit_consumes (be_consumes *node){  AST_Type  *obj = node->consumes_type ();  const char *port_name = node->local_name ()->get_string ();  const char *comp_lname = node_->local_name ();  ACE_CString comp_sname_str (    ScopeAsDecl (node_->defined_in ())->full_name ());  const char *comp_sname = comp_sname_str.c_str ();  const char *global = (comp_sname_str == "" ? "" : "::");  const char *lname = obj->local_name ()->get_string ();  const char *fname = obj->full_name ();  os_ << be_nl_2      << comp_lname << "_Servant::" << lname << "Consumer_"      << port_name << "_Servant::" << lname << "Consumer_"      << port_name << "_Servant (" << be_idt << be_idt_nl      << global << comp_sname << "::CCM_" << comp_lname      << "_ptr executor," << be_nl      << global << comp_sname << "::CCM_" << comp_lname      << "_Context_ptr c)" << be_uidt_nl      << ": executor_ ( " << global << comp_sname << "::CCM_"      << comp_lname << "::_duplicate (executor))," << be_idt_nl      << "ctx_ ( " << global << comp_sname      << "::CCM_" << comp_lname      << "_Context::_duplicate (c))" << be_uidt << be_uidt_nl      << "{" << be_nl      << "}";  os_ << be_nl_2      << comp_lname << "_Servant::" << lname << "Consumer_"      << port_name << "_Servant::~" << lname << "Consumer_"      << port_name << "_Servant (void)" << be_nl      << "{" << be_nl      << "}";  os_ << be_nl_2      << "::CORBA::Object_ptr" << be_nl      << comp_lname << "_Servant::" << lname << "Consumer_"      << port_name << "_Servant::_get_component (void)" << be_nl      << "{" << be_idt_nl;  if (ACE_OS::strcmp (be_global->ciao_container_type (), "Session") == 0)    {      os_ << "return this->ctx_->get_CCM_object ();";    }  else    {      os_ << "return ::CORBA::Object::_nil ();";    }  os_ << be_uidt_nl << "}";  os_ << be_nl_2      << "void" << be_nl      << comp_lname << "_Servant::" << lname << "Consumer_"      << port_name << "_Servant::push_" << lname      << " (" << be_idt_nl      << "::" << fname << " * evt)" << be_uidt_nl      << "{" << be_idt_nl      << "this->executor_->push_" << port_name      << " (evt);" << be_uidt_nl      << "}";  os_ << be_nl_2      << "/// Inherited from ::Components::EventConsumerBase."      << be_nl      << "void" << be_nl      << comp_lname << "_Servant::" << lname << "Consumer_"      << port_name << "_Servant::push_event (" << be_idt_nl      << "::Components::EventBase * ev)" << be_uidt_nl      << "{" << be_idt_nl      << "::" << fname << " * ev_type =" << be_idt_nl      << "::" << fname << "::_downcast (ev);"      << be_uidt_nl << be_nl      << "if (ev_type != 0)" << be_idt_nl      << "{" << be_idt_nl      << "this->push_" << lname << " (ev_type);" << be_nl      << "return;" << be_uidt_nl      << "}" << be_uidt_nl << be_nl      << "throw ::Components::BadEventType ();" << be_uidt_nl      << "}";  if (!be_global->gen_lwccm ())    {      os_ << be_nl_2          << "::" << fname << "Consumer_ptr" << be_nl          << node_->local_name () << "_Servant::get_consumer_"          << port_name << " (void)" << be_nl          << "{" << be_idt_nl          << "return" << be_idt_nl          << "::" << fname << "Consumer::_duplicate (" << be_idt_nl          << "this->consumes_" << port_name << "_.in ());"          << be_uidt << be_uidt << be_uidt_nl          << "}";    }  os_ << be_nl_2//.........这里部分代码省略.........
开发者ID:DOCGroup,项目名称:ACE_TAO,代码行数:101,


示例26: AST_illegal_recursive_type

boolAST_illegal_recursive_type (AST_Decl *t){  if (t == 0)    {      return false;    }  AST_Decl::NodeType nt;  AST_Type *ut = AST_Type::narrow_from_decl (t);  if (ut != 0)    {      ut = ut->unaliased_type ();      nt = ut->node_type ();    }  else    {      nt = t->node_type ();    }  if (nt == AST_Decl::NT_interface)    {      // Check for interface->struct/union->....->interface nesting.//      return AST_illegal_interface_recursion (t);    }  else if (nt != AST_Decl::NT_struct && nt != AST_Decl::NT_union)    {      // Structs and unions fall through to the check below.      return false;  // NOT ILLEGAL.    }  bool check_for_struct = false;  bool check_for_union = false;  AST_Structure  *st1 = 0;  AST_Union  *un1 = 0;  // Narrow the type appropriately so comparison will work.  if (t->node_type () == AST_Decl::NT_struct)    {      check_for_struct = true;      st1 = AST_Structure::narrow_from_decl (t);      if (st1 == 0)        {          return false;  // NOT ILLEGAL.        }    }  else if (t->node_type () == AST_Decl::NT_union)    {      check_for_union = true;      un1 = AST_Union::narrow_from_decl (t);      if (un1 == 0)        {          return false;  // NOT ILLEGAL.        }    }  UTL_Scope  *s = 0;  AST_Structure *st2 = 0;  AST_Union *un2 = 0;  // OK, iterate up the stack.  for (UTL_ScopeStackActiveIterator i (idl_global->scopes ());       !i.is_done ();       i.next ())    {      s = i.item ();      // If we hit a NULL we're done since it means that we're nested inside      // a sequence, where recursive types may be used.      if (s == 0)        {          return false;  // NOT ILLEGAL.        }      // OK, must check this scope.      if (s->scope_node_type () == AST_Decl::NT_struct          && check_for_struct == true)        {          st2 = AST_Structure::narrow_from_scope (s);          if (st2 != 0 && st2 == st1)            {              return true;  // ILLEGAL RECURSIVE TYPE USE.            }        }      else if (s->scope_node_type () == AST_Decl::NT_union               && check_for_union == true)        {          un2 = AST_Union::narrow_from_scope (s);          if (un2 != 0 && un2 == un1)            {              return true;  // ILLEGAL RECURSIVE TYPE USE.            }        }    }//.........这里部分代码省略.........
开发者ID:CCJY,项目名称:ATCD,代码行数:101,


示例27: ACE_ERROR_RETURN

intbe_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,



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


C++ AStackString类代码示例
C++ AST_Decl类代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。