本文整理汇总了C++中AST_Type类的典型用法代码示例。如果您正苦于以下问题:C++ AST_Type类的具体用法?C++ AST_Type怎么用?C++ AST_Type使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AST_Type类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2:
int
be_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;
}
示例3:
void
be_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 ();
}
}
示例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;
}
}
}
示例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;
}
示例6:
// 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;
}
示例7: return
bool
AST_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));
}
示例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 ();
}
}
示例9: prefix
int
be_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;
}
示例10: ACE_ERROR_RETURN
int
ast_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;
}
示例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);
}
示例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;
}
示例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;
}
示例14: if
int
be_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;
}
示例15:
// Compute total number of members.
int
AST_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;
}