本文整理汇总了C++中UTL_ScopeActiveIterator类的典型用法代码示例。如果您正苦于以下问题:C++ UTL_ScopeActiveIterator类的具体用法?C++ UTL_ScopeActiveIterator怎么用?C++ UTL_ScopeActiveIterator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UTL_ScopeActiveIterator类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1:
// Compute the size type of the node in question.
int
AST_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,代码来源:ast_structure.cpp
示例2: assert
void
be_enum::FinishProtoTypeCode()
{
// flesh out typecode
// since enums names are all in a scope and not added directly
// we go through the scope and add them all here
UTL_Scope* s = (UTL_Scope*)narrow((long) & UTL_Scope::type_id);
assert(s);
UTL_ScopeActiveIterator* i = 0;
i = new UTL_ScopeActiveIterator(s, UTL_Scope::IK_decls);
if (s->nmembers() > 0)
{
for ( ; !(i->is_done()); i->next())
{
AST_Decl* d = i->item();
assert(d);
m_typecode->member_names.push_back(d->local_name()->get_string());
}
delete i;
}
}
开发者ID:osrf,项目名称:opensplice,代码行数:25,代码来源:xbe_enum.cpp
示例3:
int
ast_visitor_tmpl_module_inst::visit_scope (UTL_Scope *node)
{
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,
ACE_TEXT ("ast_visitor_tmpl_module_inst::")
ACE_TEXT ("visit_scope - ")
ACE_TEXT ("bad node in this scope\n")),
-1);
}
// Send the visitor.
if (d == 0 || d->ast_accept (this) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("ast_visitor_tmpl_module_inst::")
ACE_TEXT ("visit_scope - ")
ACE_TEXT ("codegen for scope failed\n")),
-1);
}
}
return 0;
}
开发者ID:asdlei00,项目名称:ACE,代码行数:31,代码来源:ast_visitor_tmpl_module_inst.cpp
示例4:
// Dump this AST_Factory node to the ostream o.
void
AST_Finder::dump (ACE_OSTREAM_TYPE &o)
{
AST_Decl *d = 0;
this->dump_i (o, "finder ");
this->local_name ()->dump (o);
this->dump_i (o, "(");
// Iterator must be explicitly advanced 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, ")");
}
开发者ID:asdlei00,项目名称:ACE,代码行数:26,代码来源:ast_finder.cpp
示例5:
void
be_visitor_valuetype_obv_cs::gen_obv_init_constructor_inits (
be_valuetype *node
)
{
TAO_OutStream *os = this->ctx_->stream ();
AST_Type *parent = node->inherits_concrete ();
// Generate for inherited members first.
if (parent != 0)
{
be_valuetype *be_parent = be_valuetype::narrow_from_decl (parent);
this->gen_obv_init_constructor_inits (be_parent);
}
for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
!si.is_done ();
si.next())
{
// be_attribute inherits from be_field
// so we have to also screen out attributes
be_field *f = be_field::narrow_from_decl (si.item ());
be_attribute *attr =
be_attribute::narrow_from_decl (si.item ());
if (f == 0 || attr != 0)
{
continue;
}
*os << be_nl
<< f->local_name () << " (_tao_init_" << f->local_name ()
<< ");";
}
}
开发者ID:manut,项目名称:TAO,代码行数:35,代码来源:valuetype_obv_cs.cpp
示例6:
int
be_visitor_home_attr_set::visit_home (be_home *node)
{
if (node == 0)
{
return 0;
}
for (UTL_ScopeActiveIterator i (node, UTL_Scope::IK_decls);
!i.is_done ();
i.next ())
{
be_decl *d = be_decl::narrow_from_decl (i.item ());
if (d->accept (this) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("be_visitor_home_attr_set")
ACE_TEXT ("::visit_home - ")
ACE_TEXT ("accept () failed\n")),
-1);
}
}
be_home *h = be_home::narrow_from_decl (node->base_home ());
return this->visit_home (h);
}
开发者ID:CCJY,项目名称:ATCD,代码行数:28,代码来源:home_svs.cpp
示例7: that
void be_exception::GenerateAssignmentOperator (be_ClientImplementation& source)
{
ostream & os = source.Stream ();
DDS_StdString that ("");
be_Type * btype;
if (nmembers ())
{
that = " that";
}
os << ScopedName () << " & "
<< ScopedName () << "::operator = (const "
<< LocalName () << " &" << that << ")" << nl;
os << "{" << nl;
UTL_Scope * s = (UTL_Scope*)narrow((long) & UTL_Scope::type_id);
assert (s);
UTL_ScopeActiveIterator *it;
// Iterate through decls
for
(
it = new UTL_ScopeActiveIterator (s, UTL_Scope::IK_decls);
! it->is_done ();
it->next ()
)
{
AST_Decl * adecl = it->item ();
assert (adecl);
be_field *bfield = (be_field *) adecl->narrow ((long) & be_field::type_id);
if (bfield)
{
btype = bfield->get_be_type ();
if (btype && btype->IsArrayType ())
{
// Need to copy array elements
os << " "
<< (char*) BE_Globals::RelativeScope (ScopedName (), bfield->StructMemberTypeName ())
<< "_copy (" << bfield->get_local_name ()
<< ", that." << bfield->get_local_name () << ");" << nl;
}
else
{
os << " " << bfield->get_local_name () << " = that."
<< bfield->get_local_name() << ";" << nl;
}
}
}
delete it;
os << " return *this;" << nl;
os << "}" << nl << nl;
}
开发者ID:diorahman,项目名称:opensplice,代码行数:60,代码来源:xbe_exception.cpp
示例8:
bool
be_valuetype::has_member (void)
{
AST_Type *parent = this->pd_inherits_concrete;
// We're looking for inherited members too.
if (parent != 0)
{
be_valuetype *be_parent =
be_valuetype::narrow_from_decl (parent);
if (be_parent->has_member ())
{
return true;
}
}
for (UTL_ScopeActiveIterator si (this, UTL_Scope::IK_decls);
!si.is_done ();
si.next())
{
if (si.item ()->node_type () == AST_Decl::NT_field)
{
return true;
}
}
return false;
}
开发者ID:CCJY,项目名称:ATCD,代码行数:29,代码来源:be_valuetype.cpp
示例9:
// Look up the default branch in union.
AST_UnionBranch *
AST_Union::lookup_default (void)
{
AST_UnionBranch *b = 0;
AST_Decl *d = 0;
for (UTL_ScopeActiveIterator i (this, UTL_Scope::IK_both);
!i.is_done();
i.next ())
{
d = i.item ();
if (d->node_type () == AST_Decl::NT_union_branch)
{
b = AST_UnionBranch::narrow_from_decl (d);
if (b == 0)
{
continue;
}
if (b->label () != 0
&& b->label ()->label_kind () == AST_UnionLabel::UL_default)
{
idl_global->err ()->error2 (UTL_Error::EIDL_MULTIPLE_BRANCH,
this,
b);
return b;
}
}
}
return 0;
}
开发者ID:CCJY,项目名称:ATCD,代码行数:35,代码来源:ast_union.cpp
示例10:
void
be_home::scan (UTL_Scope *s)
{
if (s == 0)
{
return;
}
for (UTL_ScopeActiveIterator i (s, UTL_Scope::IK_both);
!i.is_done ();
i.next ())
{
AST_Decl *d = i.item ();
AST_Attribute *attr =
AST_Attribute::narrow_from_decl (d);
if (attr != 0 && ! attr->readonly ())
{
this->has_rw_attributes_ = true;
return;
}
}
AST_Home *h = AST_Home::narrow_from_scope (s);
if (h != 0)
{
this->scan (h->base_home ());
}
}
开发者ID:asdlei00,项目名称:ACE,代码行数:30,代码来源:be_home.cpp
示例11: UTL_ScopeActiveIterator
void
be_CodeGenerator::Generate(be_ClientImplementation& source)
{
UTL_ScopeActiveIterator* i;
AST_Decl * d;
UTL_Scope * s = (UTL_Scope*)narrow((long) & UTL_Scope::type_id);
if (s)
{
i = new UTL_ScopeActiveIterator(s, UTL_Scope::IK_decls);
while (!(i->is_done()))
{
be_CodeGenerator * cg;
d = i->item();
if (!d->imported() &&
(cg = (be_CodeGenerator*)d->narrow((long) & be_CodeGenerator::type_id)))
{
cg->Generate(source);
}
i->next();
}
delete i;
}
else
{
assert(pbfalse);
}
}
开发者ID:xrl,项目名称:opensplice_dds,代码行数:33,代码来源:xbe_codegen.cpp
示例12: narrow
void be_root::GenerateGlobalDecls (be_ClientHeader & source)
{
UTL_ScopeActiveIterator * i;
be_CodeGenerator * cg;
AST_Decl * d;
UTL_Scope * s = (UTL_Scope*) narrow ((long) & UTL_Scope::type_id);
if (s)
{
// Iterate through decls
i = new UTL_ScopeActiveIterator (s, UTL_Scope::IK_decls);
while (!(i->is_done ()))
{
d = i->item ();
if (!d->imported ())
{
cg = (be_CodeGenerator*) d->narrow
((long) & be_CodeGenerator::type_id);
if (cg)
{
cg->Generate (source);
}
}
i->next ();
}
delete i;
}
}
开发者ID:osrf,项目名称:opensplice,代码行数:34,代码来源:xbe_root.cpp
示例13: visitor
// Operations for field marshaling.
int
be_visitor_valuetype_marshal_cs::gen_fields (be_valuetype *node,
be_visitor_context &ctx)
{
int n_processed = 0;
TAO_OutStream *os = ctx.stream ();
this->elem_number_ = 0;
// 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)
{
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("be_visitor_scope::visit_scope - ")
ACE_TEXT ("bad node in this scope\n")),
-1);
}
// (JP) 2010-10-21
// be_attribute now inherits from be_field, so we need this check.
be_attribute *attr = be_attribute::narrow_from_decl (d);
be_field *field = be_field::narrow_from_decl (d);
if (field != 0 && attr == 0)
{
if (n_processed > 0)
{
*os << " &&" << be_nl;
}
++n_processed;
be_visitor_valuetype_field_cdr_cs visitor (&ctx);
visitor.pre_ = node->field_pd_prefix ();
visitor.post_ = node->field_pd_postfix ();
if (visitor.visit_field (field) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("be_visitor_valuetype_marshal_cs::")
ACE_TEXT ("visit_valuetype - ")
ACE_TEXT ("codegen for scope failed\n")),
-1);
}
}
}
if (n_processed == 0)
{
*os << "true";
}
return 0;
}
开发者ID:asdlei00,项目名称:ACE,代码行数:60,代码来源:marshal_cs.cpp
示例14: tab
void be_exception::GenerateConvenienceConstructor (be_ClientHeader& source)
{
ostream & os = source.Stream ();
const char * argPrefix = "_";
pbbool first = pbtrue;
be_Tab tab (source);
os << tab << LocalName () << " (";
UTL_Scope * s = (UTL_Scope*)narrow ((long) & UTL_Scope::type_id);
assert (s);
// Iterate through decls
UTL_ScopeActiveIterator *it;
for
(
it = new UTL_ScopeActiveIterator (s, UTL_Scope::IK_decls);
!it->is_done ();
it->next ()
)
{
AST_Decl * adecl = it->item();
assert (adecl);
be_field * bfield = be_field::_narrow (adecl);
be_Type * btype;
if (bfield)
{
btype = bfield->get_be_type ();
if (!first)
{
os << ", ";
}
first = pbfalse;
if (btype && btype->IsStringType ())
{
// Strings are special case
os << (char*) BE_Globals::RelativeScope (ScopedName (), bfield->InTypeName ());
}
else
{
os << (char*) BE_Globals::RelativeScope (ScopedName (), bfield->StructMemberTypeName ());
}
os << " " << argPrefix << (char*) bfield->get_local_name ();
}
}
delete it;
os << ");" << nl;
}
开发者ID:diorahman,项目名称:opensplice,代码行数:58,代码来源:xbe_exception.cpp
示例15:
// Compute total number of members.
int
AST_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,代码来源:ast_operation.cpp
示例16: ctx
int
be_visitor_amh_operation_sh::visit_operation (be_operation *node)
{
/// If there is an argument of type "native", return immediately.
if (node->has_native ())
{
return 0;
}
/// These are not for the server side.
if (node->is_sendc_ami ())
{
return 0;
}
// Output stream.
TAO_OutStream *os = this->ctx_->stream ();
this->ctx_->node (node);
this->generate_shared_prologue (node, os, "");
be_visitor_context ctx (*this->ctx_);
be_visitor_args_arglist arglist_visitor (&ctx);
arglist_visitor.set_fixed_direction (AST_Argument::dir_IN);
ctx.scope (node);
for (UTL_ScopeActiveIterator i (node, UTL_Scope::IK_decls);
!i.is_done ();
i.next ())
{
be_argument *argument =
be_argument::narrow_from_decl (i.item ());
if (argument == 0
|| argument->direction () == AST_Argument::dir_OUT)
{
continue;
}
*os << "," << be_nl;
if (arglist_visitor.visit_argument (argument) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_amh_operation_sh::"
"visit_operation - "
"codegen for upcall args failed\n"),
-1);
}
}
*os << be_uidt_nl
<< ") = 0;" << be_uidt_nl;
return 0;
}
开发者ID:CCJY,项目名称:ATCD,代码行数:56,代码来源:amh_sh.cpp
示例17:
int
be_visitor_valuetype::visit_valuetype_scope (be_valuetype *node)
{
this->elem_number_ = 0;
for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
!si.is_done ();
si.next())
{
AST_Decl *d = si.item ();
if (!d)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_scope::visit_scope - "
"bad node in this scope\n"),
-1);
}
be_decl *bd = be_decl::narrow_from_decl (d);
// Set the scope node as "node" in which the code is being
// generated so that elements in the node's scope can use it
// for code generation.
this->ctx_->scope (node);
this->ctx_->node (bd);
this->elem_number_++;
AST_Field *field = AST_Field::narrow_from_decl (d);
if (field != 0 && field->visibility () == AST_Field::vis_PRIVATE)
{
this->begin_private ();
}
else
{
this->begin_public ();
}
if (bd == 0 || bd->accept (this) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_scope::visit_scope - "
"codegen for scope failed\n"),
-1);
}
}
return 0;
}
开发者ID:CCJY,项目名称:ATCD,代码行数:51,代码来源:valuetype.cpp
示例18:
void
be_visitor_valuetype_obv_cs::gen_obv_call_base_constructor_args (
be_valuetype *node,
unsigned long &index
)
{
TAO_OutStream *os = this->ctx_->stream ();
// Generate for inherited members first.
AST_Type *parent = node->inherits_concrete ();
if (parent != 0)
{
be_valuetype *be_parent =
be_valuetype::narrow_from_decl (parent);
this->gen_obv_call_base_constructor_args (be_parent, index);
}
// Now generate for each "derived" added members
for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
!si.is_done ();
si.next())
{
// be_attribute inherits from be_field
// so we have to also screen out attributes
be_field *f = be_field::narrow_from_decl (si.item ());
if (f && !be_attribute::narrow_from_decl (si.item ()))
{
if (index++) // comma before 2nd onwards
*os << ",";
// output each accessor on new line
*os << be_nl;
// Check the member type for nested valuetypes
be_type *t = be_type::narrow_from_decl (f->field_type ());
if (be_valuetype_fwd::narrow_from_decl (t) ||
be_valuetype::narrow_from_decl (t) ||
be_valuebox::narrow_from_decl (t) )
{
// Nested valuetypes/boxes need to be deep copied also
*os << "(" << f->local_name () << " () ?" << be_idt_nl
<< t->full_name () << "::_downcast (" << f->local_name ()
<< " ()->_copy_value ())" << be_nl
<< ": 0)" << be_uidt;
}
else // Simple non-nested type
*os << f->local_name () << " ()";
}
}
}
开发者ID:DOCGroup,项目名称:ACE_TAO,代码行数:50,代码来源:valuetype_obv_cs.cpp
示例19: visit_scope
//
// visit_scope
//
int Provides_Svnt_Impl::visit_scope (UTL_Scope * node)
{
// Interfaces could be in a different IDL file, so we don't want to
// skip them as the default visit_scope implementation does
for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
!si.is_done (); si.next ())
{
AST_Decl * d = si.item ();
if (0 != d->ast_accept (this))
return -1;
}
return 0;
}
开发者ID:SEDS,项目名称:CUTS,代码行数:17,代码来源:Provides_Svnt_Impl.cpp
示例20: switch
void
be_component::mirror_scan (AST_PortType *pt)
{
AST_Uses *u = 0;
AST_Provides *p = 0;
AST_Attribute *a = 0;
for (UTL_ScopeActiveIterator i (pt, UTL_Scope::IK_decls);
!i.is_done ();
i.next ())
{
AST_Decl *d = i.item ();
switch (d->node_type ())
{
case AST_Decl::NT_provides:
++this->n_uses_;
p = AST_Provides::narrow_from_decl (d);
if (!p->provides_type ()->is_local ())
{
++this->n_remote_uses_;
}
continue;
case AST_Decl::NT_uses:
++this->n_provides_;
u = AST_Uses::narrow_from_decl (d);
if (!u->uses_type ()->is_local ())
{
++this->n_remote_provides_;
}
continue;
case AST_Decl::NT_attr:
a = AST_Attribute::narrow_from_decl (d);;
if (!a->readonly ())
{
this->has_rw_attributes_ = true;
}
continue;
default:
continue;
}
}
}
开发者ID:asdlei00,项目名称:ACE,代码行数:49,代码来源:be_component.cpp
注:本文中的UTL_ScopeActiveIterator类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论