本文整理汇总了C++中ACE_Arg_Shifter::ignore_arg方法的典型用法代码示例。如果您正苦于以下问题:C++ ACE_Arg_Shifter::ignore_arg方法的具体用法?C++ ACE_Arg_Shifter::ignore_arg怎么用?C++ ACE_Arg_Shifter::ignore_arg使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ACE_Arg_Shifter
的用法示例。
在下文中一共展示了ACE_Arg_Shifter::ignore_arg方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
//.........这里部分代码省略.........
示例2: init
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;
}
示例3: 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;
}
示例4: shifter
//.........这里部分代码省略.........
}
this->env_buf_len_ = ACE_OS::atoi (shifter.get_current ());
}
else if (ACE_OS::strcasecmp (shifter.get_current (),
ACE_TEXT ("-m")) == 0)
{
shifter.consume_arg ();
if (!shifter.is_anything_left () || shifter.get_current ()[0] == '-')
{
ORBSVCS_ERROR ((LM_ERROR, "Error: -m option needs "
"a maximum number of environment vars\n"));
this->print_usage ();
return -1;
}
this->max_env_vars_ = ACE_OS::atoi (shifter.get_current ());
}
else if (ACE_OS::strcasecmp (shifter.get_current (),
ACE_TEXT ("-o")) == 0)
{
shifter.consume_arg ();
if (!shifter.is_anything_left () || shifter.get_current ()[0] == '-')
{
ORBSVCS_ERROR ((LM_ERROR, "Error: -o option needs a filename\n"));
this->print_usage ();
return -1;
}
this->ior_output_file_ = shifter.get_current ();
}
else if (ACE_OS::strcasecmp (shifter.get_current (),
ACE_TEXT ("-s")) == 0)
{
this->service_ = true;
}
else if ((ACE_OS::strcasecmp (shifter.get_current (),
ACE_TEXT ("-?")) == 0)
|| (ACE_OS::strcasecmp (shifter.get_current (),
ACE_TEXT ("-h")) == 0))
{
this->print_usage ();
return 1;
}
else if (ACE_OS::strcasecmp (shifter.get_current (),
ACE_TEXT ("-n")) == 0)
{
shifter.consume_arg ();
if (!shifter.is_anything_left () || shifter.get_current ()[0] == '-')
{
ORBSVCS_ERROR ((LM_ERROR, "Error: -n option needs a name\n"));
this->print_usage ();
return -1;
}
this->name_ = ACE_TEXT_ALWAYS_CHAR(shifter.get_current ());
}
else if (ACE_OS::strcasecmp (shifter.get_current (),
ACE_TEXT ("-l")) == 0)
{
this->notify_imr_ = true;
}
else if (ACE_OS::strcasecmp (shifter.get_current (),
ACE_TEXT ("-delay")) == 0)
{
shifter.consume_arg ();
if (!shifter.is_anything_left () || shifter.get_current ()[0] == '-')
{
ORBSVCS_ERROR ((LM_ERROR, "Error: -delay option needs a value\n"));
this->print_usage ();
return -1;
}
this->induce_delay_ = ACE_OS::atoi (shifter.get_current ());
}
else if (ACE_OS::strcasecmp (shifter.get_current (),
ACE_TEXT ("-detach")) == 0)
{
shifter.consume_arg ();
if (!shifter.is_anything_left () || shifter.get_current ()[0] == '-')
{
ORBSVCS_ERROR ((LM_ERROR, "Error: -detach option needs a value\n"));
this->print_usage ();
return -1;
}
this->detach_child_ = ACE_OS::atoi (shifter.get_current ()) != 0;
}
else
{
shifter.ignore_arg ();
continue;
}
shifter.consume_arg ();
}
return 0;
}