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


C++ AST_Type::defined_in方法代码示例

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


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

示例1: ScopeAsDecl

int
be_visitor_ami4ccm_rh_ex_idl::visit_interface (be_interface *node)
{
  os_ << be_nl
      << "// TAO_IDL - Generated from" << be_nl
      << "// " << __FILE__ << ":" << __LINE__;

  os_ << be_nl_2
      << "local interface AMI4CCM_"
      << node->original_local_name ()
      << "ReplyHandler" << be_idt_nl
      << ": ";

  long n_parents = node->n_inherits ();

  if (n_parents == 0)
    {
      os_ << "::CCM_AMI::ReplyHandler";
    }
  else
    {
      os_ << be_idt;

      for (long i = 0; i < n_parents; ++i)
        {
          if (i != 0)
            {
              os_ << "," << be_nl;
            }

          AST_Type *parent = node->inherits ()[i];

          AST_Decl *d = ScopeAsDecl (parent->defined_in ());

          bool global = (d->node_type () == AST_Decl::NT_root);

          os_ << (global ? "" : "::") << d->full_name ()
              << "::AMI4CCM_" << parent->original_local_name ()
              << "ReplyHandler";
        }

      os_ << be_uidt;
    }

  os_ << be_uidt_nl
      << "{" << be_idt;

  if (this->visit_scope (node) == -1)
    {
      ACE_ERROR_RETURN ((LM_ERROR,
                         ACE_TEXT ("be_visitor_ami4ccm_rh_ex_idl")
                         ACE_TEXT ("::visit_interface - ")
                         ACE_TEXT ("visit_scope() failed\n")),
                        -1);
    }

  os_ << be_uidt_nl
      << "};";

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

示例2: 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;
}
开发者ID:DOCGroup,项目名称:ACE_TAO,代码行数:90,代码来源:servant_svs.cpp

示例3: sname_str

int
be_visitor_context_svts::visit_publishes (be_publishes *node)
{
  AST_Type *obj = node->publishes_type ();
  const char *port_name =
    node->local_name ()->get_string ();
  const char *fname = obj->full_name ();
  const char *lname = obj->local_name ()->get_string ();
  ACE_CString sname_str (
    ScopeAsDecl (obj->defined_in ())->full_name ());

  os_ << be_nl_2
      << "template <typename CONTAINER_TYPE, typename BASE>" << be_nl
      << "void" << be_nl
      << node_->local_name () << "_Context_T<CONTAINER_TYPE, BASE>::push_"
      << port_name << " (" << be_idt_nl
      << "::" << fname << " * ev)" << be_uidt_nl
      << "{" << be_idt_nl;

  os_ << "ACE_GUARD (TAO_SYNCH_MUTEX," << be_nl
      << "           mon," << be_nl
      << "           this->" << port_name
      << "_lock_);" << be_nl_2;

  os_ << "for (" << tao_cg->upcase (port_name)
      << "_TABLE::const_iterator iter =" << be_nl
      << "       this->ciao_publishes_" << port_name
      << "_.begin ();" << be_nl
      << "     iter != this->ciao_publishes_" << port_name
      << "_.end ();" << be_nl
      << "     ++iter)" << be_idt_nl
      << "{" << be_idt_nl
      << "iter->second->push_" << lname << " (ev);"
      << be_uidt_nl
      << "}" << be_uidt << be_uidt_nl
      << "}";

  os_ << be_nl_2
      << "template <typename CONTAINER_TYPE, typename BASE>" << be_nl
      << "::Components::Cookie *" << be_nl
      << node_->local_name () << "_Context_T<CONTAINER_TYPE, BASE>::subscribe_"
      << port_name << " (" << be_idt_nl
      << "::" << fname << "Consumer_ptr c)" << be_uidt_nl
      << "{" << be_idt_nl
      << "if ( ::CORBA::is_nil (c))" << be_idt_nl
      << "{" << be_idt_nl
      << "throw ::Components::InvalidConnection ();" << be_uidt_nl
      << "}" << be_uidt_nl << be_nl;

  os_ << "ptrdiff_t const ptr = reinterpret_cast<ptrdiff_t> (c);"
      << be_nl_2;

  os_ << "{" << be_idt_nl
      << "ACE_GUARD_RETURN (TAO_SYNCH_MUTEX," << be_nl
      << "                  mon," << be_nl
      << "                  this->" << port_name
      << "_lock_," << be_nl
      << "                  0);";

  os_ << be_nl_2
      << "::" << fname << "Consumer_var ciao_var = " << be_idt_nl
      << "::" << fname << "Consumer::_duplicate (c);" << be_uidt << be_nl_2
      << "std::pair<" << tao_cg->upcase (port_name) <<"_TABLE::iterator, bool> ret =" << be_idt_nl
      << "this->ciao_publishes_" << port_name
      << "_.insert (" << be_idt_nl << tao_cg->upcase (port_name)
      << "_TABLE::value_type (ptr, ciao_var.in ()));"
      << be_uidt << be_uidt_nl
      << "if (!ret.second)" << be_idt_nl
      << "{" << be_idt_nl
      << "throw ::Components::AlreadyConnected ();" << be_uidt_nl
      << "}" << be_uidt_nl
      << "ciao_var._retn ();" << be_uidt_nl
      << "}";

  os_ << be_nl
      << be_nl
      << "::Components::Cookie * retv = 0;" << be_nl
      << "ACE_NEW_THROW_EX (retv," << be_nl
      << "                  ::CIAO::Cookie_Impl (ptr),"
      << be_nl
      << "                  ::CORBA::NO_MEMORY ());"
      << be_nl_2
      << "return retv;" << be_uidt_nl
      << "}";

  os_ << be_nl_2
      << "template <typename CONTAINER_TYPE, typename BASE>" << be_nl
      << "::" << fname << "Consumer_ptr" << be_nl
      << node_->local_name () << "_Context_T<CONTAINER_TYPE, BASE>::unsubscribe_"
      << port_name << " (" << be_idt_nl
      << "::Components::Cookie * ck)" << be_uidt_nl
      << "{" << be_idt_nl
      << "ptrdiff_t key = 0UL;" << be_nl_2
      << "if (ck == 0 || ! ::CIAO::Cookie_Impl::extract (ck, key))"
      << be_idt_nl
      << "{" << be_idt_nl
      << "throw ::Components::InvalidConnection ();" << be_uidt_nl
      << "}" << be_uidt_nl << be_nl;

  os_ << "{" << be_idt_nl
//.........这里部分代码省略.........
开发者ID:DOCGroup,项目名称:ACE_TAO,代码行数:101,代码来源:context_svts.cpp


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