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


C++ ACE_Arg_Shifter类代码示例

本文整理汇总了C++中ACE_Arg_Shifter的典型用法代码示例。如果您正苦于以下问题:C++ ACE_Arg_Shifter类的具体用法?C++ ACE_Arg_Shifter怎么用?C++ ACE_Arg_Shifter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: if

void
TAO_Notify_Tests_Options_Parser::execute (CosNotification::EventTypeSeq& added, CosNotification::EventTypeSeq& removed, ACE_Arg_Shifter& arg_shifter)
{
    const ACE_TCHAR* current_arg = 0;

    while (arg_shifter.is_anything_left ())
    {
        current_arg = arg_shifter.get_current ();
        arg_shifter.consume_arg ();

        if (current_arg[0] == '+')
        {
            // create 1 more space.
            int seq_ln =  added.length ();
            added.length (seq_ln + 1);

            added[seq_ln].domain_name = CORBA::string_dup ("*");
            added[seq_ln].type_name = CORBA::string_dup (ACE_TEXT_ALWAYS_CHAR(++current_arg)); // Skip the '+' sign.
        }
        else if (current_arg[0] == '-')
        {
            // create 1 more space.
            int seq_ln =  removed.length ();
            removed.length (seq_ln + 1);

            removed[seq_ln].domain_name = CORBA::string_dup ("*");
            removed[seq_ln].type_name = CORBA::string_dup (ACE_TEXT_ALWAYS_CHAR(++current_arg)); // Skip the '-' sign.
        }
    }
}
开发者ID:asdlei00,项目名称:ACE,代码行数:30,代码来源:Options_Parser.cpp

示例2:

int
Client_Options::boolean_option (ACE_Arg_Shifter &arg_shifter,
                                const ACE_TCHAR *option_name,
                                int &option_value)
{
  if (ACE_OS::strcmp (arg_shifter.get_current (), option_name) != 0)
    return 0;
  arg_shifter.consume_arg ();
  option_value = 1;
  return 1;
}
开发者ID:asdlei00,项目名称:ACE,代码行数:11,代码来源:Client_Options.cpp

示例3:

int
Job_i::init (ACE_Arg_Shifter& arg_shifter)
{
    // Read the name of the Job
    job_name_ = ACE_TEXT_ALWAYS_CHAR(arg_shifter.get_current ());
    arg_shifter.consume_arg ();

    // Read the name of the POA
    POA_name_ = ACE_TEXT_ALWAYS_CHAR(arg_shifter.get_current ());
    arg_shifter.consume_arg ();

    return 0;
}
开发者ID:akostrikov,项目名称:ATCD,代码行数:13,代码来源:Job_i.cpp

示例4: if

int
TAO_Notify_Tests_Periodic_Consumer::init_state (ACE_Arg_Shifter& arg_shifter)
{
  // First, let the base class look for options.
  if (TAO_Notify_Tests_StructuredPushConsumer::init_state (arg_shifter) == -1)
    return -1;

  const ACE_TCHAR *current_arg = 0;

  while (arg_shifter.is_anything_left ())
    {
      if (0 != (current_arg = arg_shifter.get_the_parameter (ACE_TEXT("-MaxCount"))))
        {
          this->max_count_ = ACE_OS::atoi (current_arg);
          arg_shifter.consume_arg ();

          if (max_count_ == 0)
          {
            if (this->client_)
              this->client_->done (this);
          }
        }
       else if (arg_shifter.cur_arg_strncasecmp (ACE_TEXT("-Check_Priority")) == 0)
         {
          this->check_priority_ = 1;

          arg_shifter.consume_arg ();
         }
       else
         {
           break;
         }
    } /* while */

  return 0;
}
开发者ID:asdlei00,项目名称:ACE,代码行数:36,代码来源:Periodic_Consumer.cpp

示例5: if

void
TAO_Notify_Tests_Filter_Command::init (ACE_Arg_Shifter& arg_shifter)
{
  if (arg_shifter.is_anything_left ())
    {
      if (arg_shifter.cur_arg_strncasecmp (ACE_TEXT("-CreateFactory")) == 0) // -Create factory_name ec
        {
          this->command_ = CREATE_FACTORY;

          arg_shifter.consume_arg ();

          this->name_ = ACE_TEXT_ALWAYS_CHAR(arg_shifter.get_current ()); // FF name
          arg_shifter.consume_arg ();

          this->factory_ = ACE_TEXT_ALWAYS_CHAR(arg_shifter.get_current ()); //EC
          arg_shifter.consume_arg ();
        }
      else if (arg_shifter.cur_arg_strncasecmp (ACE_TEXT("-CreateFilter")) == 0) // -CreateFilter filter_name filterfactory_name
        {
          this->command_ = CREATE_FILTER;

          arg_shifter.consume_arg ();

          this->name_ = ACE_TEXT_ALWAYS_CHAR(arg_shifter.get_current ()); // Filter name

          arg_shifter.consume_arg ();

          this->factory_ = ACE_TEXT_ALWAYS_CHAR(arg_shifter.get_current ()); //FF
          arg_shifter.consume_arg ();
        }
      else if (arg_shifter.cur_arg_strncasecmp (ACE_TEXT("-Add_Constraint")) == 0) // -Add_Constraint filter_name constraint_expr
        {
          this->command_ = ADD_CONSTRAINT;

          arg_shifter.consume_arg ();

          this->name_ = ACE_TEXT_ALWAYS_CHAR(arg_shifter.get_current ()); // Filter name

          arg_shifter.consume_arg ();

          this->constraint_ = ACE_TEXT_ALWAYS_CHAR(arg_shifter.get_current ()); //Constraint
          arg_shifter.consume_arg ();
        }
      else if (arg_shifter.cur_arg_strncasecmp (ACE_TEXT("-Add_Filter")) == 0) // -Add_Filter filter_name FilterAdmin_Name
        {
          this->command_ = ADD_FILTER;

          arg_shifter.consume_arg ();

          this->name_ = ACE_TEXT_ALWAYS_CHAR(arg_shifter.get_current ()); // Filter name

          arg_shifter.consume_arg ();

          this->factory_ = ACE_TEXT_ALWAYS_CHAR(arg_shifter.get_current ()); //FilterAdmin
          arg_shifter.consume_arg ();
        }
      else if (arg_shifter.cur_arg_strncasecmp (ACE_TEXT("-Destroy")) == 0) // -Destroy filter_name
        {
          this->command_ = DESTROY;

          arg_shifter.consume_arg ();

          this->name_ = ACE_TEXT_ALWAYS_CHAR(arg_shifter.get_current ()); // filter

          arg_shifter.consume_arg ();
        }
    }
}
开发者ID:asdlei00,项目名称:ACE,代码行数:68,代码来源:Filter_Command.cpp

示例6: as

int
DllORB::init (int argc, ACE_TCHAR *argv[])
{
  int threadCnt = 1;

  try
    {
      ACE_Arg_Shifter as (argc, argv);
      const ACE_TCHAR *currentArg = 0;
      while (as.is_anything_left ())
        {
          if ((currentArg = as.get_the_parameter (ACE_TEXT ("-NumThreads"))))
            {
              int num = ACE_OS::atoi (currentArg);
              if (num >= 1)
                threadCnt = num;
              as.consume_arg ();
            }
        else
          as.ignore_arg ();
        }

      if (failPrePostInit_ < 3)
        {
          ACE_DEBUG ((LM_INFO,
                      ACE_TEXT ("Pre-ORB initialization ...\n")));
          // -----------------------------------------------------------------
          // Pre-ORB initialization steps necessary for proper DLL ORB
          // support.
          // -----------------------------------------------------------------
          // Make sure TAO's singleton manager is initialized, and set to not
          // register itself with the ACE_Object_Manager since it is under the
          // control of the Service Configurator.  If we register with the
          // ACE_Object_Manager, then the ACE_Object_Manager will still hold
          // (dangling) references to instances of objects created by this
          // module and destroyed by this object when it is dynamically
          // unloaded.
          int register_with_object_manager = 0;
          TAO_Singleton_Manager * p_tsm = TAO_Singleton_Manager::instance ();
          int result = p_tsm->init (register_with_object_manager);

          if (result == -1)
            {
              if (failPrePostInit_ == 0)
                {
                  ACE_DEBUG ((LM_ERROR,
                              ACE_TEXT ("Pre-ORB initialization failed.\n")));
                  return -1;
                }
              else if (failPrePostInit_ < 2)
                {
                  ACE_DEBUG ((LM_WARNING,
                              ACE_TEXT ("Pre-ORB initialization failed (ignored due to FailPrePostInit setting).\n")));
                }
              else
                {
                  ACE_DEBUG ((LM_INFO,
                              ACE_TEXT ("Pre-ORB initialization failed (ignored due to FailPrePostInit setting).\n")));
                }
            }
          else
            {
              ACE_DEBUG ((LM_INFO,
                          ACE_TEXT ("Pre-ORB initialization done.\n")));
            }
        }

      // Initialize the ORB
      ACE_Argv_Type_Converter argcon (argc, argv);
      mv_orb_ = CORBA::ORB_init (argcon.get_argc (), argcon.get_TCHAR_argv ());
      if (CORBA::is_nil (mv_orb_.in ()))
        {
          ACE_DEBUG ((LM_ERROR, ACE_TEXT ("nil ORB\n")));
          return -1;
        }

      CORBA::Object_var v_poa =
        mv_orb_->resolve_initial_references ("RootPOA");

      mv_rootPOA_ = PortableServer::POA::_narrow (v_poa.in ());
      if (CORBA::is_nil (mv_rootPOA_.in ()))
        {
          ACE_DEBUG ((LM_ERROR, ACE_TEXT ("nil RootPOA\n")));
          return -1;
        }

      mv_poaManager_ = mv_rootPOA_->the_POAManager ();
      if (CORBA::is_nil (mv_poaManager_.in ()))
        {
          ACE_DEBUG ((LM_ERROR, ACE_TEXT ("nil POAManager\n")));
          return -1;
        }

      mv_poaManager_->activate ();
    }
  catch (...)
  {
    ACE_DEBUG ((LM_ERROR, ACE_TEXT ("ERROR: exception\n")));
    return -1;
  }
//.........这里部分代码省略.........
开发者ID:esohns,项目名称:ATCD,代码行数:101,代码来源:DllORB.cpp

示例7: if

void
TAO_Notify_Tests_Application_Command::init (ACE_Arg_Shifter& arg_shifter)
{
  if (arg_shifter.is_anything_left ())
    {
      /// -Init | Run | Shutdown
      if (arg_shifter.cur_arg_strncasecmp (ACE_TEXT("-Init")) == 0)
        {
          this->command_ = INIT;

          arg_shifter.consume_arg ();
        }
      else if (arg_shifter.cur_arg_strncasecmp (ACE_TEXT("-Run")) == 0)
        {
          this->command_ = RUN;

          arg_shifter.consume_arg ();
        }
      else if (arg_shifter.cur_arg_strncasecmp (ACE_TEXT("-WaitForEvents")) == 0)
        {
          this->command_ = WAIT_FOR_EVENTS;

          arg_shifter.consume_arg ();
        }
      else if (arg_shifter.cur_arg_strncasecmp (ACE_TEXT("-Shutdown")) == 0)
        {
          this->command_ = SHUTDOWN;

          arg_shifter.consume_arg ();
        }
      else if (arg_shifter.cur_arg_strncasecmp (ACE_TEXT("-DumpStats")) == 0)
        {
          this->command_ = DUMP_STATE;

          arg_shifter.consume_arg ();

          if (arg_shifter.cur_arg_strncasecmp (ACE_TEXT("-Samples")) == 0)
            {
              this->dump_samples_ = 1;

              arg_shifter.consume_arg ();
            }
        }
      else if (arg_shifter.cur_arg_strncasecmp (ACE_TEXT("-SignalPeer")) == 0)
        {
          this->command_ = SIGNAL_PEER;

          arg_shifter.consume_arg ();
        }
      else if (arg_shifter.cur_arg_strncasecmp (ACE_TEXT("-WaitToStart")) == 0)
        {
          this->command_ = WAIT_TO_START;

          arg_shifter.consume_arg ();
        }

    }
}
开发者ID:CCJY,项目名称:ATCD,代码行数:58,代码来源:Application_Command.cpp

示例8: as

int
DllOrb::init (int argc, ACE_TCHAR *argv[])
{
  int threadCnt = 1;

  try
  {
    ACE_Arg_Shifter as (argc, argv);
    const ACE_TCHAR *currentArg = 0;
    while (as.is_anything_left ())
    {
      if (0 != (currentArg = as.get_the_parameter (ACE_TEXT ("-NumThreads"))))
      {
        int num = ACE_OS::atoi (currentArg);
        if (num >= 1)
          threadCnt = num;
        as.consume_arg ();
      }
      else
        as.ignore_arg ();
    }

    // Initialize the ORB
    mv_orb_ = CORBA::ORB_init (argc, argv);
    if (CORBA::is_nil (mv_orb_.in ()))
    {
      ACE_DEBUG ((LM_ERROR, ACE_TEXT ("nil ORB\n")));
      return -1;
    }

    CORBA::Object_var v_poa =
      mv_orb_->resolve_initial_references ("RootPOA");

    mv_rootPOA_ = PortableServer::POA::_narrow (v_poa.in ());
    if (CORBA::is_nil (mv_rootPOA_.in ()))
    {
      ACE_DEBUG ((LM_ERROR, ACE_TEXT ("nil RootPOA\n")));
      return -1;
    }

    mv_poaManager_ = mv_rootPOA_->the_POAManager ();
    if (CORBA::is_nil (mv_poaManager_.in ()))
    {
      ACE_DEBUG ((LM_ERROR, ACE_TEXT ("nil POAManager\n")));
      return -1;
    }

    mv_poaManager_->activate ();
  }
  catch (...)
  {
    ACE_DEBUG ((LM_ERROR, ACE_TEXT ("ERROR: exception\n")));
    return -1;
  }

  ACE_auto_ptr_reset (ma_barrier_, new ACE_Thread_Barrier (threadCnt + 1));

  this->activate(
    THR_NEW_LWP|THR_JOINABLE|THR_INHERIT_SCHED,
    threadCnt
  );
  ACE_DEBUG ((LM_INFO, ACE_TEXT ("init mp_barrier->wait() ...\n")));
  ma_barrier_->wait();
  ACE_DEBUG ((LM_INFO, ACE_TEXT ("init mp_barrier->wait() done\n")));

  return 0;
}
开发者ID:asdlei00,项目名称:ACE,代码行数:67,代码来源:DllOrb.cpp

示例9: ACE_TMAIN

int ACE_TMAIN(int argc, ACE_TCHAR* argv[])
{
  bool ok = false;
  DomainParticipantFactory_var dpf;
  DomainParticipant_var dp_sub, dp_pub;
  try {
    dpf = TheParticipantFactoryWithArgs(argc, argv);
    dp_sub = dpf->create_participant(9, PARTICIPANT_QOS_DEFAULT,
                                     0, DEFAULT_STATUS_MASK);
    if (!dp_sub) {
      ACE_DEBUG((LM_ERROR, "ERROR: %P could not create Sub Domain Participant\n"));

    } else {
      {
        // New scope.
        ACE_Arg_Shifter shifter (argc, argv);
        while (shifter.is_anything_left ()) {
          const ACE_TCHAR* x = shifter.get_the_parameter (ACE_TEXT("-value_base"));
          if (x != NULL) {
            TestConfig::set (ACE_OS::atoi (x));
          }

          shifter.consume_arg ();
        }
      }

      DomainParticipantQos dp_qos;
      dpf->get_default_participant_qos(dp_qos);
      set_qos(dp_qos.user_data.value, TestConfig::PARTICIPANT_USER_DATA());
      dp_pub = dpf->create_participant(9, dp_qos, 0, DEFAULT_STATUS_MASK);

      if (!dp_pub) {
        ACE_DEBUG((LM_ERROR, "ERROR: %P could not create Domain Participant 2\n"));

      } else {
        ok = run_test(dp_sub, dp_pub);

        if (!ok) {
          ACE_DEBUG((LM_ERROR, "ERROR: %P from run_test\n"));
          return -1;
        }
      }
    }
  } catch (const std::exception& e) {
    ACE_DEBUG((LM_ERROR, "ERROR: %P Exception thrown: %C\n", e.what()));
    return -2;
  } catch (const CORBA::Exception& e) {
    e._tao_print_exception("ERROR: %P Exception thrown:");
    return -2;
  } catch (const OpenDDS::DCPS::Transport::Exception&) {
    ACE_DEBUG((LM_ERROR, "ERROR: %P Transport exception thrown\n"));
    return -2;
  } catch (...) {
    ACE_DEBUG((LM_ERROR, "ERROR: %P unknown exception thrown\n"));
    return -2;
  }

  ACE_DEBUG((LM_INFO, "%P Cleaning up test\n"));
  cleanup(dpf, dp_sub);
  ACE_OS::sleep(2);
  cleanup(dpf, dp_pub);
  TheServiceParticipant->shutdown();
  ACE_Thread_Manager::instance()->wait();
  return ok ? EXIT_SUCCESS : EXIT_FAILURE;
}
开发者ID:yanbodiaoweng,项目名称:DDS,代码行数:65,代码来源:RtpsDiscoveryTest.cpp

示例10: if

int
Periodic_Task::init_task (ACE_Arg_Shifter& arg_shifter)
{
  const ACE_TCHAR *current_arg = 0;

  while (arg_shifter.is_anything_left ())
    {
      if (0 != (current_arg = arg_shifter.get_the_parameter (ACE_TEXT("-JobName"))))
        {
          name_ = ACE_TEXT_ALWAYS_CHAR(current_arg);
          arg_shifter.consume_arg ();
        }
      else if (0 != (current_arg = arg_shifter.get_the_parameter (ACE_TEXT("-Priority"))))
        {
          task_priority_ = ACE_OS::atoi (current_arg);
          arg_shifter.consume_arg ();
        }
      else if (0 != (current_arg = arg_shifter.get_the_parameter (ACE_TEXT("-Period"))))
        {
          period_ = ACE_OS::atoi (current_arg);
          arg_shifter.consume_arg ();
        }
      else if (0 != (current_arg = arg_shifter.get_the_parameter (ACE_TEXT("-ExecTime"))))
        {
          exec_time_ = ACE_OS::atoi (current_arg);
          arg_shifter.consume_arg ();
        }
      else if (0 != (current_arg = arg_shifter.get_the_parameter (ACE_TEXT("-Phase"))))
        {
          phase_ = ACE_OS::atoi (current_arg);
          arg_shifter.consume_arg ();
        }
      else if (0 != (current_arg = arg_shifter.get_the_parameter (ACE_TEXT("-Iter"))))
        {
          iter_ = ACE_OS::atoi (current_arg);
          arg_shifter.consume_arg ();

          // create the stat object.
          ACE_NEW_RETURN (task_stats_, Task_Stats (iter_), -1);

          if (task_stats_->init () == -1)
            return -1;
        }
      else if (0 != (current_arg = arg_shifter.get_the_parameter (ACE_TEXT("-Load"))))
        {
          load_ = ACE_OS::atoi (current_arg);
          arg_shifter.consume_arg ();

          return 0;
        }
      else
        {
          ACE_DEBUG ((LM_DEBUG, "parse Task unknown option %s\n",
                      arg_shifter.get_current ()));
          if (TAO_debug_level > 0)
            ACE_DEBUG ((LM_DEBUG, "name %s, priority %d, period %duS, exec_time %duS, phase %duS, iter %d, load %d\n",
                        name_.c_str(), task_priority_, period_, exec_time_, phase_, iter_, load_));
          break;
        }
    }
  return 0;
}
开发者ID:CCJY,项目名称:ATCD,代码行数:62,代码来源:Periodic_Task.cpp

示例11: as

int DllOrb::init (int argc, ACE_TCHAR *argv[])
{
  int result = 0;
  int threadCnt = this->m_nthreads_;

  try
  {
    ACE_Arg_Shifter as (argc, argv);
    const ACE_TCHAR *currentArg = 0;
    while (as.is_anything_left ())
      {
        if (0 != (currentArg = as.get_the_parameter (ACE_TEXT ("-t"))))
          {
            int num = ACE_OS::atoi (currentArg);
            if (num >= 1)
              threadCnt = num;
            as.consume_arg ();
          }
        else
          as.ignore_arg ();
      }

    if (m_failPrePostInit < 3)
      {
        ACE_DEBUG((LM_DEBUG, "TEST (%P|%t) Pre-ORB initialization ...\n"));

        // -----------------------------------------------------------------
        // Pre-ORB initialization steps necessary for proper DLL ORB
        // support.
        // -----------------------------------------------------------------
        // Make sure TAO's singleton manager is initialized, and set to not
        // register itself with the ACE_Object_Manager since it is under the
        // control of the Service Configurator.  If we register with the
        // ACE_Object_Manager, then the ACE_Object_Manager will still hold
        // (dangling) references to instances of objects created by this
        // module and destroyed by this object when it is dynamically
        // unloaded.
        int register_with_object_manager = 0;
        TAO_Singleton_Manager * p_tsm = TAO_Singleton_Manager::instance ();
        result = p_tsm->init (register_with_object_manager);

        if (result == -1 && m_failPrePostInit == 0)
          return -1;
      }

    // Initialize the ORB
    mv_orb = CORBA::ORB_init (argc, argv);
    if (CORBA::is_nil (mv_orb.in ()))
      return -1;

    CORBA::Object_var v_poa = mv_orb->resolve_initial_references ("RootPOA");

    mv_rootPOA = PortableServer::POA::_narrow (v_poa.in ());
    if (CORBA::is_nil (mv_rootPOA.in ()))
      return -1;

    mv_poaManager = mv_rootPOA->the_POAManager ();
    if (CORBA::is_nil (mv_poaManager.in ()))
      return -1;

    mv_poaManager->activate ();
  }
  catch(CORBA::Exception& ex)
  {
    ex._tao_print_exception (ACE_TEXT ("(%P|%t) init failed:"));
    return -1;
  }
  catch (...)
  {
    ACE_ERROR_RETURN ((LM_ERROR,
                       ACE_TEXT ("(%P|%t) init failed\n")),
                      -1);
  }

#if defined (ACE_HAS_THREADS)
  mp_barrier = new ACE_Thread_Barrier (threadCnt + 1);

  this->activate(
                 THR_NEW_LWP|THR_JOINABLE|THR_INHERIT_SCHED,
                 threadCnt
                 );
  mp_barrier->wait ();
#endif

  return 0;
}
开发者ID:chenbk85,项目名称:ACE-Middleware,代码行数:86,代码来源:DllOrb.cpp

示例12: ACE_TMAIN

int
ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
  try {
    // Initialize DomainParticipantFactory
    DDS::DomainParticipantFactory_var dpf =
      TheParticipantFactoryWithArgs(argc, argv);

    enum {
      READER,
      WRITER
    } mode = READER;
    bool toggle = false;

    {
      // New scope.
      ACE_Arg_Shifter shifter (argc, argv);
      while (shifter.is_anything_left ()) {
        const ACE_TCHAR* x = shifter.get_current();
        if (ACE_OS::strcmp(x, ACE_TEXT("-reader")) == 0) {
          mode = READER;
        }
        if (ACE_OS::strcmp(x, ACE_TEXT("-writer")) == 0) {
          mode = WRITER;
        }
        if (ACE_OS::strcmp(x, ACE_TEXT("-toggle")) == 0) {
          toggle = true;
        }
        shifter.consume_arg ();
      }
    }

    // Create DomainParticipant
    DDS::DomainParticipantQos dp_qos;
    dpf->get_default_participant_qos(dp_qos);
    dp_qos.user_data.value.length(6);
    dp_qos.user_data.value[0] = 0;
    dp_qos.user_data.value[1] = 0;
    dp_qos.user_data.value[2] = 0;
    dp_qos.user_data.value[3] = 0;
    dp_qos.user_data.value[4] = 0;
    dp_qos.user_data.value[5] = (mode == READER) ? 0 : 1;

    DDS::DomainParticipant_var participant =
      dpf->create_participant(DOMAIN_ID,
                              dp_qos,
                              0,
                              OpenDDS::DCPS::DEFAULT_STATUS_MASK);

    if (!participant) {
      ACE_ERROR_RETURN((LM_ERROR,
                        ACE_TEXT("ERROR: %N:%l: main() -")
                        ACE_TEXT(" create_participant failed!\n")),
                       -1);
    }

    // Register TypeSupport
    TestMsgTypeSupport_var ts =
      new TestMsgTypeSupportImpl;

    if (ts->register_type(participant, "") != DDS::RETCODE_OK) {
      ACE_ERROR_RETURN((LM_ERROR,
                        ACE_TEXT("ERROR: %N:%l: main() -")
                        ACE_TEXT(" register_type failed!\n")),
                       -1);
    }

    // Create Topic
    CORBA::String_var type_name = ts->get_type_name();
    DDS::Topic_var topic =
      participant->create_topic("TheTopic",
                                type_name,
                                TOPIC_QOS_DEFAULT,
                                0,
                                OpenDDS::DCPS::DEFAULT_STATUS_MASK);

    if (!topic) {
      ACE_ERROR_RETURN((LM_ERROR,
                        ACE_TEXT("ERROR: %N:%l: main() -")
                        ACE_TEXT(" create_topic failed!\n")),
                       -1);
    }

    int return_code = 1;
    switch (mode) {
    case READER:
      return_code = do_reader(participant, topic, toggle);
      break;
    case WRITER:
      return_code = do_writer(participant, topic, toggle);
      break;
    }

    // Clean-up!
    participant->delete_contained_entities();
    dpf->delete_participant(participant);

    TheServiceParticipant->shutdown();
    return return_code;

//.........这里部分代码省略.........
开发者ID:stonejiang208,项目名称:OpenDDS,代码行数:101,代码来源:StaticDiscoveryTest.cpp

示例13:

int
DT_Creator::dt_task_init (ACE_Arg_Shifter& arg_shifter)
{
  static int dt_index = 0;
  time_t start_time = 0;
  int load = 0;
  int iter = 0;
  int importance = 0;
  char *job_name = 0;
  int dist = 0;
  const ACE_TCHAR* current_arg = 0;

  if (arg_shifter.cur_arg_strncasecmp (ACE_TEXT("-Importance")) == 0)
    {
      arg_shifter.consume_arg ();
      current_arg = arg_shifter.get_current ();
      importance = ACE_OS::atoi (current_arg);
      arg_shifter.consume_arg ();
    }

  if (0 != (current_arg = arg_shifter.get_the_parameter (ACE_TEXT("-Start_Time"))))
    {
      start_time = ACE_OS::atoi (current_arg);
      arg_shifter.consume_arg ();
    }

  if (0 != (current_arg = arg_shifter.get_the_parameter (ACE_TEXT("-Iter"))))
    {
      iter = ACE_OS::atoi (current_arg);
      arg_shifter.consume_arg ();
    }

  if (0 != (current_arg = arg_shifter.get_the_parameter (ACE_TEXT("-Load"))))
    {
      load = ACE_OS::atoi (current_arg);
      arg_shifter.consume_arg ();
    }

  if (0 != (current_arg = arg_shifter.get_the_parameter (ACE_TEXT("-JobName"))))
    {
      job_name = (char *)current_arg;
      dist = 1;
      arg_shifter.consume_arg ();
    }

  dt_list_ [dt_index++] = this->create_thr_task (importance,
             start_time,
             load,
             iter,
             dist,
             job_name);

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

示例14: ACE_TMAIN

int
ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
  try {
    // Initialize DomainParticipantFactory
    DDS::DomainParticipantFactory_var dpf =
      TheParticipantFactoryWithArgs(argc, argv);

    std::string participant_id;
    std::vector<std::string> readers;
    std::vector<std::string> writers;
    bool reliable = false;
    int total_readers = 0, total_writers = 0;

    {
      // New scope.
      ACE_Arg_Shifter shifter (argc, argv);
      while (shifter.is_anything_left ()) {
        const ACE_TCHAR* x;
        x = shifter.get_the_parameter (ACE_TEXT("-participant"));
        if (x != NULL) {
          participant_id = ACE_TEXT_ALWAYS_CHAR(x);
        }
        x = shifter.get_the_parameter (ACE_TEXT("-reader"));
        if (x != NULL) {
          readers.push_back(ACE_TEXT_ALWAYS_CHAR(x));
        }
        x = shifter.get_the_parameter (ACE_TEXT("-writer"));
        if (x != NULL) {
          writers.push_back(ACE_TEXT_ALWAYS_CHAR(x));
        }
        x = shifter.get_the_parameter (ACE_TEXT("-reliable"));
        if (x != NULL) {
          reliable = ACE_OS::atoi(x);
        }
        x = shifter.get_the_parameter (ACE_TEXT("-total_readers"));
        if (x != NULL) {
          total_readers = ACE_OS::atoi(x);
        }
        x = shifter.get_the_parameter (ACE_TEXT("-total_writers"));
        if (x != NULL) {
          total_writers = ACE_OS::atoi(x);
        }

        shifter.consume_arg ();
      }
    }

    participant_id.resize(12);

    // Create DomainParticipant
    DDS::DomainParticipantQos dp_qos;
    dpf->get_default_participant_qos(dp_qos);
    dp_qos.user_data.value.length(6);
    dp_qos.user_data.value[0] = fromhex(participant_id, 0);
    dp_qos.user_data.value[1] = fromhex(participant_id, 1);
    dp_qos.user_data.value[2] = fromhex(participant_id, 2);
    dp_qos.user_data.value[3] = fromhex(participant_id, 3);
    dp_qos.user_data.value[4] = fromhex(participant_id, 4);
    dp_qos.user_data.value[5] = fromhex(participant_id, 5);

    DDS::DomainParticipant_var participant =
      dpf->create_participant(DOMAIN_ID,
                              dp_qos,
                              0,
                              OpenDDS::DCPS::DEFAULT_STATUS_MASK);

    if (!participant) {
      ACE_ERROR_RETURN((LM_ERROR,
                        ACE_TEXT("ERROR: %N:%l: main() -")
                        ACE_TEXT(" create_participant failed!\n")),
                       -1);
    }

    // Register TypeSupport
    TestMsgTypeSupport_var ts =
      new TestMsgTypeSupportImpl;

    if (ts->register_type(participant, "") != DDS::RETCODE_OK) {
      ACE_ERROR_RETURN((LM_ERROR,
                        ACE_TEXT("ERROR: %N:%l: main() -")
                        ACE_TEXT(" register_type failed!\n")),
                       -1);
    }

    // Create Topic
    CORBA::String_var type_name = ts->get_type_name();
    DDS::Topic_var topic =
      participant->create_topic("TheTopic",
                                type_name,
                                TOPIC_QOS_DEFAULT,
                                0,
                                OpenDDS::DCPS::DEFAULT_STATUS_MASK);

    if (!topic) {
      ACE_ERROR_RETURN((LM_ERROR,
                        ACE_TEXT("ERROR: %N:%l: main() -")
                        ACE_TEXT(" create_topic failed!\n")),
                       -1);
    }
//.........这里部分代码省略.........
开发者ID:tempbottle,项目名称:OpenDDS,代码行数:101,代码来源:StaticDiscoveryTest.cpp

示例15: if

int
POA_Holder::init (ACE_Arg_Shifter& arg_shifter)
{
  ACE_DEBUG ((LM_DEBUG,
        "Init POA\n"));

  const ACE_TCHAR *current_arg = 0;

  POA_name_ = ACE_TEXT_ALWAYS_CHAR(arg_shifter.get_current ()); // Read the name of the POA
  arg_shifter.consume_arg ();

  while (arg_shifter.is_anything_left ())
    {
      if (0 != (current_arg = arg_shifter.get_the_parameter (ACE_TEXT("-PriorityModel"))))
        {
          if (arg_shifter.cur_arg_strncasecmp (ACE_TEXT("CLIENT")) == 0)
            priority_model_ = RTCORBA::CLIENT_PROPAGATED;
          else
            priority_model_ = RTCORBA::SERVER_DECLARED;
          arg_shifter.consume_arg ();

          server_priority_ = ACE_OS::atoi (current_arg);
          arg_shifter.consume_arg ();
        }
      else if (0 != (current_arg = arg_shifter.get_the_parameter (ACE_TEXT("-Lanes"))))
        {
          int lanecount = ACE_OS::atoi (current_arg);
          lanes_.length (lanecount);
          arg_shifter.consume_arg ();

          int l_index = 0;
          //parse lane values ...
          while (arg_shifter.is_anything_left ())
            {
              if (arg_shifter.cur_arg_strncasecmp (ACE_TEXT("-Lane")) == 0)
                {
                  arg_shifter.consume_arg ();

                  // read priority
                  lanes_[l_index].lane_priority = ACE_OS::atoi (arg_shifter.get_current ());
                  arg_shifter.consume_arg ();

                  // static thread count
                  lanes_[l_index].static_threads = ACE_OS::atoi (arg_shifter.get_current ());
                  arg_shifter.consume_arg ();

                  // dynamic thread count
                  lanes_[l_index].dynamic_threads = ACE_OS::atoi (arg_shifter.get_current ());
                  arg_shifter.consume_arg ();

                  //if (TAO_debug_level > 0)
                  ACE_DEBUG ((LM_DEBUG, "lane parsed - %d, %d, %d\n",
                              lanes_[l_index].lane_priority, lanes_[l_index].static_threads, lanes_[l_index].dynamic_threads));
                  l_index++;
                }
        else
                break;
            } /* while -- lane values */

        } /* if -Lanes */
      else if (arg_shifter.cur_arg_strncasecmp (ACE_TEXT("-ThreadPool")) == 0)
  {
    ACE_DEBUG ((LM_DEBUG,
          "Thread Pool\n"));

    arg_shifter.consume_arg ();
    thread_pool_ = 1;
    // read priority
    tp_static_threads_ = ACE_OS::atoi (arg_shifter.get_current ());
    arg_shifter.consume_arg ();

    tp_dynamic_threads_ = ACE_OS::atoi (arg_shifter.get_current ());
    arg_shifter.consume_arg ();

    tp_priority_ = ACE_OS::atoi (arg_shifter.get_current ());
    arg_shifter.consume_arg ();
    ACE_DEBUG ((LM_DEBUG,
          "Thread Pool Initialized\n"));

  }
      else if (0 != (current_arg = arg_shifter.get_the_parameter (ACE_TEXT("-Bands"))))
        {
    ACE_DEBUG ((LM_DEBUG,
          "Initializing Bands\n"));

          int bandcount = ACE_OS::atoi (current_arg);
          bands_.length (bandcount);
          arg_shifter.consume_arg ();

          int b_index = 0;
          //parse band values ...
          while (arg_shifter.is_anything_left ())
            {
              if (arg_shifter.cur_arg_strncasecmp (ACE_TEXT("-Band")) == 0)
                {
                  arg_shifter.consume_arg ();

                  // read low
                  bands_[b_index].low = ACE_OS::atoi (arg_shifter.get_current ());
                  arg_shifter.consume_arg ();
//.........这里部分代码省略.........
开发者ID:asdlei00,项目名称:ACE,代码行数:101,代码来源:POA_Holder.cpp


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