本文整理汇总了C++中AST_Decl::flat_name方法的典型用法代码示例。如果您正苦于以下问题:C++ AST_Decl::flat_name方法的具体用法?C++ AST_Decl::flat_name怎么用?C++ AST_Decl::flat_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AST_Decl
的用法示例。
在下文中一共展示了AST_Decl::flat_name方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: prefix
int
be_visitor_servant_svs::visit_provides (be_provides *node)
{
if (node->provides_type ()->is_local ()) // @TODO || be_global->gen_lwccm ())
{
return 0;
}
ACE_CString prefix (this->ctx_->port_prefix ());
prefix += node->local_name ()->get_string ();
const char *port_name = prefix.c_str ();
AST_Type *obj = node->provides_type ();
const char *obj_name = obj->full_name ();
AST_Decl *scope = ScopeAsDecl (obj->defined_in ());
ACE_CString sname_str (scope->full_name ());
const char *sname = sname_str.c_str ();
// Avoid '_cxx_' prefix.
const char *lname =
obj->original_local_name ()->get_string ();
const char *global = (sname_str == "" ? "" : "::");
const char *prefix_connector = (sname_str == "" ? "" : "_");
if (!be_global->gen_lwccm ())
{
os_ << be_nl_2
<< "::" << obj_name << "_ptr" << be_nl
<< node_->local_name () << "_Servant::provide_"
<< port_name << " (void)" << be_nl
<< "{" << be_idt_nl;
os_ << "return" << be_idt_nl
<< "::" << obj_name << "::_duplicate (this->provide_"
<< port_name << "_.in ());" << be_uidt << be_uidt_nl
<< "}";
}
os_ << be_nl_2
<< "void" << be_nl
<< node_->local_name () << "_Servant::setup_"
<< port_name << "_i (void)" << be_nl
<< "{" << be_idt_nl
<< "ACE_CString obj_id (this->ins_name_);" << be_nl
<< "obj_id += \"_" << port_name << "\";" << be_nl_2
<< "::CIAO::Container_var cnt_safe =" << be_idt_nl
<< "::CIAO::Container::_duplicate ("
<< "this->container_.in ());" << be_uidt_nl << be_nl
<< "if (::CORBA::is_nil (cnt_safe.in ()))" << be_idt_nl
<< "{" << be_idt_nl << "throw ::CORBA::INV_OBJREF ();" << be_uidt_nl
<< "}" << be_uidt_nl << be_nl
<< "PortableServer::POA_var POA = cnt_safe->the_port_POA ();" << be_nl
<< "::CORBA::Object_var tmp =" << be_idt_nl
<< "this->get_facet_executor (\"" << port_name << "\");"<< be_uidt_nl << be_nl
<< global << sname << "::CCM_" << lname << "_var tmp_var = " << be_idt_nl
<< global << sname <<"::CCM_" << lname
<< "::_narrow (tmp.in());" << be_uidt_nl << be_nl
<< "typedef " << global << "CIAO_FACET" << prefix_connector
<< scope->flat_name () << "::" << obj->local_name () << "_Servant_T <" << be_idt_nl
<< "POA_" << sname << global << obj->local_name ()
<< "," << be_nl << global << sname <<"::CCM_" << lname << "," << be_nl
<< global << "Components::" << be_global->ciao_container_type ()
<< "Context>" << be_idt_nl << lname
<< "_type;" << be_uidt_nl << be_uidt_nl
<< lname << "_type *" << port_name << "_servant_impl = 0;" << be_nl
<< "ACE_NEW_THROW_EX (" << be_idt_nl
<< port_name << "_servant_impl," << be_nl
<< lname << "_type (" << be_idt_nl
<< "tmp_var.in(), " << be_nl
<< "this->context_)," << be_uidt_nl
<< "CORBA::NO_MEMORY ());" << be_uidt_nl << be_nl
<< "PortableServer::ServantBase_var safe_base_servant ("
<< port_name << "_servant_impl);" << be_nl << be_nl
<< "PortableServer::ObjectId_var " << port_name << "_servant_oid =" << be_idt_nl
<< "PortableServer::string_to_ObjectId (obj_id.c_str());" << be_uidt_nl << be_nl
<< "POA->activate_object_with_id(" << port_name << "_servant_oid.in(),"
<< port_name << "_servant_impl);" << be_nl
<< "::CORBA::Object_var " << port_name << "_servant_impl_obj = " << be_idt_nl
<< "cnt_safe->generate_reference ( " << be_idt_nl
<< "obj_id.c_str ()," << be_nl
<< "\"" << obj->repoID () << "\"," << be_nl
<< "::CIAO::Container_Types::FACET_CONSUMER_t);"
<< be_uidt_nl << be_uidt_nl
<< "this->add_facet (\"" << port_name << "\", " << port_name << "_servant_impl_obj.in ());"
<< be_uidt_nl
<< "}";
return 0;
}
示例2: arg_flat_name
int
be_visitor_arg_traits::visit_argument (be_argument *node)
{
if (this->ctx_->alias () != 0 || this->generated (node))
{
return 0;
}
AST_Type *bt = node->field_type ();
AST_Decl::NodeType nt = bt->node_type ();
// We are interested here only in unaliased, bounded
// (w)strings.
if (nt != AST_Decl::NT_string && nt != AST_Decl::NT_wstring)
{
return 0;
}
be_string *st = be_string::narrow_from_decl (bt);
ACE_CDR::ULong bound = st->max_size ()->ev ()->u.ulval;
if (bound == 0)
{
return 0;
}
TAO_OutStream *os = this->ctx_->stream ();
*os << be_nl_2 << "// TAO_IDL - Generated from" << be_nl
<< "// " << __FILE__ << ":" << __LINE__;
std::string guard_suffix =
std::string (this->S_) + std::string ("arg_traits");
// The guard should be generated to prevent multiple declarations,
// since a bounded (w)string of the same length may be used or typedef'd
// more than once.
os->gen_ifdef_macro (node->flat_name (), guard_suffix.c_str (), false);
bool wide = (st->width () != 1);
// It is legal IDL to declare a bounded (w)string as an operation
// parameter type. There could be any number of identical
// declarations in the same build, translation unit, or even in
// the same operation, so we use the argument's flat name to
// declare an empty struct, and use that struct as the template
// parameter for Arg_Traits<>.
*os << be_nl_2;
AST_Decl *op = ScopeAsDecl (node->defined_in ());
AST_Decl *intf = ScopeAsDecl (op->defined_in ());
ACE_CString arg_flat_name (intf->flat_name ());
arg_flat_name += '_';
arg_flat_name += op->local_name ()->get_string ();
arg_flat_name += '_';
arg_flat_name += node->local_name ()->get_string ();
// Avoid generating a duplicate structure in the skeleton.
if (ACE_OS::strlen (this->S_) == 0)
{
*os << "struct " << arg_flat_name.c_str () << " {};"
<< be_nl_2;
}
*os << "template<>" << be_nl
<< "class "
<< this->S_ << "Arg_Traits<"
<< arg_flat_name.c_str ()
<< ">" << be_idt_nl
<< ": public" << be_idt << be_idt_nl
<< "BD_String_" << this->S_ << "Arg_Traits_T<" << be_nl
<< "CORBA::" << (wide ? "W" : "") << "String_var," << be_nl
<< bound << "," << be_nl
<< this->insert_policy()
<< be_uidt_nl
<< ">"
<< be_uidt << be_uidt << be_uidt_nl
<< "{" << be_nl
<< "};";
os->gen_endif ();
this->generated (node, true);
return 0;
}
示例3: 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
<< "}";
//.........这里部分代码省略.........
示例4: 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;
}
//.........这里部分代码省略.........