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


C++ TAO_IOR_Manipulation_var::get_profile_count方法代码示例

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


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

示例1: iors

int
ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
  int Status = 0;

  ACE_DEBUG ((LM_DEBUG, "---------------------------------------------\n"));
  ACE_DEBUG ((LM_DEBUG, "Running the IORManipulation Tests.\n"));

  try
    {
      // Retrieve the ORB.
      CORBA::ORB_var orb_ = CORBA::ORB_init (argc,
                                             argv);

      // **********************************************************************

      // Get an object reference for the ORBs IORManipulation object!
      CORBA::Object_var IORM =
        orb_->resolve_initial_references ("IORManipulation");

      TAO_IOP::TAO_IOR_Manipulation_var iorm =
        TAO_IOP::TAO_IOR_Manipulation::_narrow (IORM.in ());

      // **********************************************************************

      // Create a few fictitious IORs
      CORBA::Object_var name1 =
        orb_->string_to_object ("corbaloc:iiop:macarena.cs.wustl.edu:6060/xyz");
      CORBA::Object_var name2 =
        orb_->string_to_object ("corbaloc:iiop:tango.cs.wustl.edu:7070/xyz");

      // **********************************************************************

      CORBA::String_var name1_ior =
        orb_->object_to_string (name1.in ());
      ACE_DEBUG ((LM_DEBUG, "\tFirst made up IOR = %C\n", name1_ior.in ()));

      CORBA::String_var name2_ior =
        orb_->object_to_string (name2.in ());
      ACE_DEBUG ((LM_DEBUG, "\tSecond made up IOR = %C\n", name2_ior.in ()));

      // **********************************************************************

      // Create IOR list for use with merge_iors.
      TAO_IOP::TAO_IOR_Manipulation::IORList iors (2);
      iors.length (2);
      iors [0] = name1;
      iors [1] = name2;

      CORBA::Object_var merged = iorm->merge_iors (iors);

      CORBA::String_var merged_ior =
        orb_->object_to_string (merged.in ());

      CORBA::ULong count1 = iorm->get_profile_count (iors [0]);

      CORBA::ULong count2 = iorm->get_profile_count (iors [1]);

      CORBA::ULong count = iorm->get_profile_count (merged.in ());

      if (count != (count1 + count2))
        ACE_DEBUG ((LM_ERROR,
                    "**ERROR (merge_profiles): "
                    "Merged profile count incorrect!\n"));

      ACE_DEBUG ((LM_DEBUG, "\tMerged IOR(%d) = %C\n",
                  count,
                  merged_ior.in ()));

      // is_in_ior throws an exception if the intersection of the two
      // IORs is NULL.
      CORBA::ULong in_count = iorm->is_in_ior (merged.in (),
                                               name1.in ());

      if (count1 != in_count)
        ACE_DEBUG ((LM_ERROR,
                    "**ERROR (merge_iors): name1 is_in_ior returned profile "
                    "count bad (%d)!\n",
                    in_count));

      in_count = iorm->is_in_ior (merged.in (),
                                  name2.in ());

      if (count2 != in_count)
        ACE_DEBUG ((LM_ERROR,
                    "**ERROR (merge_iors): name2 is_in_ior returned profile "
                    "count bad (%d)!\n",
                    in_count));

      // **********************************************************************

      // Verify ability to remove profiles from an IOR
      // First remove the second IOR from the merged IOR
      CORBA::Object_var just1 =
        iorm->remove_profiles (merged.in (), name2.in ());

      CORBA::String_var just1_ior =
        orb_->object_to_string (just1.in ());

      count = iorm->get_profile_count (just1.in ());
//.........这里部分代码省略.........
开发者ID:asdlei00,项目名称:ACE,代码行数:101,代码来源:IORTest.cpp

示例2: ACE_TMAIN

int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
  try
    {
      // initialize the ORB
      _orb = CORBA::ORB_init (argc, argv);

      // Get the "RootPOA"
      CORBA::Object_var obj = _orb->resolve_initial_references("RootPOA");
      PortableServer::POA_var poa = PortableServer::POA::_narrow(obj.in ());

      // activate its managers so it can handle incoming requests
      poa->the_POAManager()->activate();

      // get a thread going to handle incoming requests
      ACE_Thread::spawn(RunFunc);

      // we could also use the c_orbaloc syntax to get a reference to the
      // object. This will cause the _orb to talk directly to the other
      // _orb with no name service or common file involved.
      obj = _orb->string_to_object("c_orbaloc::localhost:9999/Simple");

      if (CORBA::is_nil(obj.in ()))
        {
          ACE_ERROR ((LM_ERROR, "could not get reference\n"));
          return 1;
        }

      // narrow the reference to the particular type we wish to deal with
      Simple_var simple = Simple::_narrow(obj.in ());
      if (CORBA::is_nil(simple.in ()))
        {
          ACE_ERROR ((LM_ERROR, "could not get reference\n"));
          return 1;
        }

      // create an object reference that has a bogus value for the first
      // profile
      obj = _orb->resolve_initial_references("IORManipulation");
      TAO_IOP::TAO_IOR_Manipulation_var iorm =
        TAO_IOP::TAO_IOR_Manipulation::_narrow(obj.in());

      // Status: The following scenarios appear to work:
      // - first profile invalid host name, second profile valid.
      // - first profile invalid ip number, second profiel valid.
      // - first profiel invalid port number, second profile valid.
      //
      // The following causes a core dump of the server:
      // - first and second invalid
      //
      // Note that he iormanip is being used since it is not practical
      // to have a test case that depends on a VPN being present.
      //
      CORBA::Object_var name1 =
        _orb->string_to_object ("c_orbaloc:iiop:10.0.2.3:6060/xyz");
      CORBA::Object_var name2 =
        _orb->string_to_object ("c_orbaloc:iiop:daisnot:7070/xyz");
      CORBA::String_var name1_ior = _orb->object_to_string(name1.in());
      CORBA::String_var name2_ior = _orb->object_to_string(name2.in());

      // create a callback object
      Callee_i * callee_i = new Callee_i;
      // get the CORBA reference
      PortableServer::ObjectId_var id =
        poa->activate_object (callee_i);

      CORBA::Object_var object_act = poa->id_to_reference (id.in ());

      Callee_var callee = Callee::_narrow (object_act.in ());

      if (CORBA::is_nil(callee.in ()))
        {
          ACE_ERROR ((LM_ERROR, "could not get callback object\n"));
          return 1;
        }
      else
        {
          CORBA::String_var str = _orb->object_to_string(callee.in ());
          FILE *output_file= ACE_OS::fopen ("ior", "w");
          if (output_file == 0)
            ACE_ERROR_RETURN ((LM_ERROR,
                              "Cannot open output file for writing IOR: ior\n"),
                              1);
          ACE_OS::fprintf (output_file, "%s", str.in ());
          ACE_OS::fclose (output_file);
        }

      // create a reference with two profiles with the first on being
      // bogus. If things work as they should the callback should be
      // succesful with the ORB trying the second profile.
      TAO_IOP::TAO_IOR_Manipulation::IORList iors (2);
      iors.length (2);
      iors [0] = name1;
      iors [1] = name2;

      CORBA::Object_var merged = iorm->merge_iors(iors);
        Callee_var doubleCallee = Callee::_unchecked_narrow(merged.in());

      ACE_DEBUG ((LM_DEBUG, "Profile count is %d\n",
                  iorm->get_profile_count(merged.in())));
//.........这里部分代码省略.........
开发者ID:OspreyHub,项目名称:ATCD,代码行数:101,代码来源:SimpleClient.cpp


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