本文整理汇总了C++中ACE_ARGV::argv方法的典型用法代码示例。如果您正苦于以下问题:C++ ACE_ARGV::argv方法的具体用法?C++ ACE_ARGV::argv怎么用?C++ ACE_ARGV::argv使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ACE_ARGV
的用法示例。
在下文中一共展示了ACE_ARGV::argv方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cl
static int
test_simple_argv (ACE_TCHAR *argv[])
{
// From command line.
ACE_ARGV cl (argv);
// My own stuff.
ACE_ARGV my;
// Add to my stuff.
my.add (ACE_TEXT ("-ORBEndpoint iiop://localhost:12345"));
// Combine the two (see the ace/ARGV.h constructors documentation).
ACE_ARGV a (cl.argv (),
my.argv ());
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("argc = %d\n"),
a.argc ()));
// Print the contents of the combined <ACE_ARGV>.
for (int i = 0; i < a.argc (); i++)
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT (" (%d) %s\n"),
i,
a.argv ()[i]));
return 0;
}
示例2:
int
ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
// Set up an argument vector that we can add entries to!
ACE_ARGV args;
// Manufacture a "fake" svc.conf entry to demonstrate the -S option
// that allows us to pass these entries via the "command-line"
// rather than the svc.conf file.
for (int i = 0; i < argc; i++)
args.add (argv[i]);
args.add (ACE_TEXT ("-y"));
args.add (ACE_TEXT ("-d"));
args.add (ACE_TEXT ("-S"));
args.add (ACE_TEXT ("\"static Timer_Service_1 'timer 1 10 $TRACE'\""));
args.add (ACE_TEXT ("-S"));
args.add (ACE_TEXT ("\"dynamic Timer_Service_2 Service_Object * Timer:_make_Timer_Service_2() 'timer 2 10 $TRACE'\""));
// Test the -f option!
args.add (ACE_TEXT ("-f svc.conf1"));
args.add (ACE_TEXT ("-f svc.conf2"));
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("argc = %d\n"),
args.argc ()));
// Print the contents of the combined <ACE_ARGV>.
for (int i = 0; i < args.argc (); i++)
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%d) %s\n"),
i,
args.argv ()[i]));
int const result = ACE_Service_Config::open (args.argc (),
args.argv (),
ACE_DEFAULT_LOGGER_KEY,
0);
if (result != 0)
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("open")),
1);
// Run forever, performing the configured services until we
// shutdown.
ACE_Reactor::run_event_loop ();
return 0;
}
示例3:
int
ACE_TMAIN (int, ACE_TCHAR *argv[])
{
ACE_Service_Config daemon;
ACE_ARGV new_args;
// Load the existing <argv> into our new one.
new_args.add (argv);
// Enable loading of static services.
new_args.add (ACE_TEXT ("-y"));
// Enable debugging within dynamically linked services.
new_args.add (ACE_TEXT ("-d"));
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("argc = %d\n"),
new_args.argc ()));
// Print the contents of the combined <ACE_ARGV>.
for (int i = 0; i < new_args.argc (); i++)
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%d) %s\n"),
i,
new_args.argv ()[i]));
if (daemon.open (new_args.argc (),
new_args.argv ()) == -1)
{
if (errno != ENOENT)
ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("open")),
1);
else // Use static binding.
{
ACE_ARGV args;
args.add (argv[0]);
args.add (ACE_TEXT ("-p10011")); // Port number.
ACE_Service_Object *so =
ACE_SVC_INVOKE (ACE_Naming_Context);
if (so->init (args.argc (),
args.argv ()) == -1)
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_Naming_Context")),
1);
}
}
Client_Test test_body;
if (test_body.open () == -1)
return 1;
// Run forever, performing the configured services until we are shut
// down by a SIGINT/SIGQUIT signal.
ACE_Reactor::instance ()->run_reactor_event_loop ();
test_body.close ();
return 0;
}
示例4: get_opts
int
ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("s:c:"));
int c = -1;
const ACE_TCHAR *client_cmd = 0;
while ((c = get_opts ()) != -1)
switch (c)
{
case 'c':
client_cmd = get_opts.opt_arg ();
ACE_DEBUG ((LM_DEBUG, "Client argument: %s\n", client_cmd));
break;
case 's':
server_cmd = get_opts.opt_arg ();
ACE_DEBUG ((LM_DEBUG, "Server argument: %s\n", server_cmd));
break;
default:
ACE_ERROR_RETURN ((LM_ERROR,
"Usage: collocation_test -s \"server opts\" -c \"client opts\""),
-1);
}
ACE_TCHAR cmd_line[1024];
ACE_OS::strcpy (cmd_line, ACE_TEXT("client "));
if (client_cmd != 0)
ACE_OS::strcat (cmd_line, client_cmd);
ACE_OS::strcat (cmd_line, ACE_TEXT(" -f ") THE_IOR);
ACE_ARGV args (cmd_line);
Barriers thread_barrier (2);
int retv = 1;
ACE_DEBUG ((LM_DEBUG,
"\n \t IDL_Cubit: Collocation test \n\n"));
ACE_Thread_Manager tm;
tm.spawn (reinterpret_cast<ACE_THR_FUNC> (&svr_worker),
&thread_barrier);
thread_barrier.server_init_.wait ();
ACE_OS::sleep (1);
Cubit_Client cubit_client (1);
// Make sure the server shuts itself down afterward.
if (cubit_client.init (args.argc (), args.argv ()) == -1)
return 1;
else
retv = cubit_client.run ();
thread_barrier.client_fini_.wait ();
tm.wait ();
ACE_OS::unlink (THE_IOR);
return retv;
}
示例5: InitLogStrategy
//初始化日志策略
int Frame_Logging_Strategy::InitLogStrategy(Logging_Config_Param &ConfigParam)
{
//Set Arg List
char cmdline[1024] = {0};
string strTemp = ConfigParam.m_strLogLevel;
string strLogLevel = GetLogLevel(strTemp);
if(ConfigParam.m_bSendTerminal)
{
ACE_OS::sprintf(cmdline,"-s %s -f STDERR -p %s -i %d -m %d -N %d",
ConfigParam.m_strLogFile,
strLogLevel.c_str(),
ConfigParam.m_iChkInterval,
ConfigParam.m_iLogFileMaxSize,
ConfigParam.m_iLogFileMaxCnt);
}
else
{
ACE_OS::sprintf(cmdline,"-s %s -f OSTREAM -p %s -i %d -m %d -N %d",
ConfigParam.m_strLogFile,
strLogLevel.c_str(),
ConfigParam.m_iChkInterval,
ConfigParam.m_iLogFileMaxSize,
ConfigParam.m_iLogFileMaxCnt);
}
ACE_Reactor_Impl * pImpl = 0;
ACE_NEW_RETURN (pImpl, ACE_TP_Reactor, -1);
ACE_NEW_RETURN(pLogStraReactor, ACE_Reactor(pImpl ,1), -1);
//ACE_NEW_RETURN(pLogStraReactor, ACE_Reactor, -1);
ACE_NEW_RETURN(pLogStrategy, My_ACE_Logging_Strategy, -1);
//Set Reactor
pLogStrategy->reactor(pLogStraReactor);
ACE_ARGV args;
//args.add(__argv[0]);
args.add(ACE_TEXT(cmdline));
pLogStrategy->init(args.argc(),args.argv());
if (ACE_Thread_Manager::instance ()->spawn(ACE_THR_FUNC (run_reactor), (void *)pLogStraReactor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,"Spawning Reactor.\n"),-1);
}
ACE_DEBUG((LM_INFO, ACE_TEXT("(%P|%t) %M Init Log Strategy Success [%N,%l]\n")));
return 0;
}
示例6: failed
int
ACE_TMAIN(int, ACE_TCHAR **)
{
int result = 0;
#if 0
ACE_Service_Config serviceConfig;
char signum[64];
ACE_OS::sprintf(signum, "%d", SIGUSR1);
ACE_ARGV args;
args.add(argv[0]);
args.add("-s");
args.add(signum);
result = serviceConfig.open (
args.argc(),
args.argv(),
ACE_DEFAULT_LOGGER_KEY,
1, // ignore_static_svcs = 1,
1, // ignore_default_svc_conf_file = 0,
0 // ignore_debug_flag = 0
);
if(0 != result)
{
ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) Error: serviceConfig.open failed\n")));
return result;
}
ACE_DEBUG ((LM_INFO, ACE_TEXT ("(%P|%t) serviceConfig.open done\n")));
#endif
for(int cnt = 0; cnt < 1000; ++cnt)
{
ACE_DEBUG ((LM_INFO, ACE_TEXT ("(%P|%t) Loading ORB cnt = %d\n"), cnt));
result = ACE_Service_Config::process_directive(scpc_loadOrb);
if(0 != result)
{
ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) Error loading ORB failed (%d)\n"), result));
return result;
}
ACE_DEBUG ((LM_INFO, ACE_TEXT ("(%P|%t) Loading ORB done\n")));
result = ACE_Service_Config::process_directive(scpc_unloadOrb);
if(0 != result)
{
ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) Error unloading ORB failed (%d)\n"), result));
return result;
}
ACE_DEBUG ((LM_INFO, ACE_TEXT ("(%P|%t) Unloading ORB done\n")));
}
return result;
}
示例7: av
int
ImR_Locator_i::init (Options& opts)
{
this->opts_ = &opts;
ACE_CString cmdline = opts.cmdline ();
cmdline += " -orbuseimr 0";
ACE_ARGV av (ACE_TEXT_CHAR_TO_TCHAR (cmdline.c_str ()));
int argc = av.argc ();
ACE_TCHAR** argv = av.argv ();
CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, "TAO_ImR_Locator");
int err = this->init_with_orb (orb.in ());
return err;
}
示例8: InitInstance
BOOL CNamingViewerApp::InitInstance()
{
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
/*
From MFC 5.0, Enable3dControls and Enable3dControlsStatic are obsolete
because their functionality is incorporated into Microsoft's 32-bit
operating systems. Basically no need to call with VC5.0 and above.
#if !defined (_WIN32_WCE)
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
#endif
*/
// Parse command line arguments so we can initialize ORB with them
ACE_ARGV Argv (m_lpCmdLine);
ACE::init();
{
int argc = Argv.argc ();
CORBA::ORB_var ORB = CORBA::ORB_init(argc, Argv.argv());
CNamingViewerDlg dlg(ORB);
m_pMainWnd = &dlg;
int const nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
// dismissed with OK
}
else if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
// dismissed with Cancel
}
}
ACE::fini();
// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
}
示例9: av
int
ImR_Activator_i::init (Activator_Options& opts)
{
ACE_CString cmdline = opts.cmdline();
// Must use IOR style objrefs, because URLs sometimes get mangled when passed
// to ACE_Process::spawn().
cmdline += "-ORBUseImR 0 -ORBObjRefStyle IOR ";
ACE_ARGV av (cmdline.c_str ());
int argc = av.argc ();
CORBA::ORB_var orb =
CORBA::ORB_init (argc, av.argv (), "TAO_ImR_Activator");
int ret = this->init_with_orb(orb.in (), opts);
return ret;
}
示例10: arguments
int
Handle_Events::serve (char *buf)
{
ACE_ARGV arguments (buf);
if (ACE_OS::strcmp (arguments[0], TESTER) == 0)
{
ACE_Process_Options po;
ACE_Process p;
po.set_handles (ACE_INVALID_HANDLE, OUTPUT_FILE, OUTPUT_FILE);
po.command_line (arguments.argv ());
p.spawn (po);
return 0;
}
else
return -1;
}
示例11: args
/// Dynamically link the shared object file and retrieve a pointer to
/// the designated shared object in this file.
int
ACE_Service_Gestalt::initialize_i (const ACE_Service_Type *sr,
const ACE_TCHAR *parameters)
{
ACE_TRACE ("ACE_Service_Gestalt::initialize_i");
ACE_ARGV args (parameters);
if (sr->type ()->init (args.argc (),
args.argv ()) == -1)
{
// We just get ps to avoid having remove() delete it.
ACE_Service_Type *ps = 0;
this->repo_->remove (sr->name (), &ps);
#ifndef ACE_NLOGGING
// Not using LM_ERROR here to avoid confusing the test harness
if (ACE::debug ())
ACELIB_ERROR_RETURN ((LM_WARNING,
ACE_TEXT ("ACE (%P|%t) SG::initialize_i -")
ACE_TEXT (" repo=%@, name=%s - remove failed: %m\n"),
this->repo_,
sr->name ()),
-1);
#endif
return -1;
}
if (this->repo_->insert (sr) == -1)
{
#ifndef ACE_NLOGGING
// Not using LM_ERROR here to avoid confusing the test harness
if (ACE::debug ())
ACELIB_ERROR_RETURN ((LM_WARNING,
ACE_TEXT ("ACE (%P|%t) SG::initialize_i -")
ACE_TEXT (" repo=%@, name=%s - insert failed: %m\n"),
this->repo_,
sr->name ()),
-1);
#endif
return -1;
}
return 0;
}
示例12: not
int
run_main (int, ACE_TCHAR *argv[])
{
ACE_START_TEST (ACE_TEXT ("Bug_2975_Regression_Test"));
int ret = 0;
ACE_ARGV args;
args.add (argv[0], true);
args.add (ACE_TEXT("-S"));
#if (ACE_USES_CLASSIC_SVC_CONF == 1)
args.add (
ACE_TEXT ("\"dynamic ACE_Logger Service_Object * ")
ACE_TEXT ("ACE:_make_ACE_Logging_Strategy() ")
ACE_TEXT ("'-p ~TRACE|DEBUG|INFO|WARNING|NOTICE|ERROR|CRITICAL|ALERT'")
ACE_TEXT ("\""));
#else // not (ACE_USES_CLASSIC_SVC_CONF == 1)
args.add (
ACE_TEXT ("'<ACE_Svc_Conf>")
ACE_TEXT ("<dynamic id=\"ACE_Logger\"")
ACE_TEXT (" type=\"Service_Object\">")
ACE_TEXT ("<initializer path=\"ACE\"")
ACE_TEXT (" init=\"_make_ACE_Logging_Strategy\"")
ACE_TEXT (" params=\"-p ~TRACE|DEBUG|INFO|WARNING|NOTICE|ERROR|CRITICAL|ALERT\"/>")
ACE_TEXT ("</dynamic>")
ACE_TEXT ("</ACE_Svc_Conf>'"));
#endif // not (ACE_USES_CLASSIC_SVC_CONF == 1)
ret = ACE_Service_Config::open(args.argc(), args.argv(),
ACE_DEFAULT_LOGGER_KEY,
1, 1);
if (0 != ret)
{
ACE_ERROR ((LM_ERROR, ACE_TEXT ("ACE_Service_Config::open() failed\n")));
}
ACE_END_TEST;
return 0;
}
示例13: args
void *
svr_worker (void *arg)
{
Cubit_Server cubit_server;
Barriers *thread_barrier = (Barriers *) arg;
ACE_TCHAR cmd_line[BUFSIZ];
ACE_OS::strcpy (cmd_line, ACE_TEXT("server "));
if (server_cmd != 0)
ACE_OS::strcat (cmd_line, server_cmd);
ACE_OS::strcat (cmd_line, ACE_TEXT(" -f ") THE_IOR);
ACE_ARGV args (cmd_line);
try
{
int result = cubit_server.init (args.argc (),
args.argv ());
if (result == -1)
return (void *) 1;
thread_barrier->server_init_.wait ();
cubit_server.run ();
thread_barrier->client_fini_.wait ();
}
catch (const CORBA::SystemException& sysex)
{
sysex._tao_print_exception ("System Exception");
return (void *) 1;
}
catch (const CORBA::UserException& userex)
{
userex._tao_print_exception ("User Exception");
return (void *) 1;
}
return 0;
}
示例14:
int
run_main (int, ACE_TCHAR *[])
{
ACE_START_TEST (ACE_TEXT ("Bug_3319_Regression_Test"));
ACE_Log_Msg *log_msg = ACE_LOG_MSG;
ACE_ARGV args;
args.add (ACE_TEXT("MyProgram"), true);
int ret = ACE_Service_Config::open(args.argc(), args.argv(),
ACE_DEFAULT_LOGGER_KEY,
1, 1, 1);
if (ACE_OS::strcmp (log_msg->program_name (), ACE_TEXT("MyProgram")) != 0)
{
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("Program name is not <MyProgram> but <%s>\n"),
ACE_Log_Msg::program_name ()),
1);
}
ACE_END_TEST;
return ret;
}
示例15: sprintf
////////////////////////////////////////////////////////////////////////
// Now the svc() method where everything interesting happens.
//
int
SphinxSpeechTask::svc()
{
#ifdef DEBUG
ACE_DEBUG ((LM_DEBUG, "(%P|%t) Task 0x%x starts in thread %u\n", (void *) this, ACE_Thread::self ()));
#endif
ACE_ARGV args;
int error;
int16 adbuf[4097];
int32 ts;
string strtmp;
string hmmDir=getenv("SPHINX_ROOT");
hmmDir+="/model/hmm/6k";
search_hyp_t * result;
SentenceIDL sentence;
char * argvtmp;
args.add("SphinxSpeech");
args.add("-live TRUE");
args.add("-ctloffset 0");
args.add("-ctlcount 100000000");
args.add("-agcemax TRUE");
args.add("-langwt 6.5");
args.add("-fwdflatlw 8.5");
args.add("-rescorelw 9.5");
args.add("-ugwt 0.5");
args.add("-fillpen 1e-10");
args.add("-silpen 0.005");
args.add("-inspen 0.65");
args.add("-top 1");
args.add("-topsenfrm 3");
args.add("-topsenthresh -70000");
args.add("-beam 2e-06");
args.add("-npbeam 2e-06");
args.add("-lpbeam 2e-05");
args.add("-lponlybeam 0.0005");
args.add("-nwbeam 0.0005");
args.add("-fwdflat FALSE");
args.add("-fwdflatbeam 1e-08");
args.add("-fwdflatnwbeam 0.0003");
args.add("-bestpath TRUE");
args.add("-dictfn");
argvtmp=(char*)malloc(255*sizeof(char));
sprintf(argvtmp,"%s",speechImpl->dict.c_str());
args.add(argvtmp);
args.add("-noisedict");
argvtmp=(char*)malloc(255*sizeof(char));
sprintf(argvtmp,"%s/noisedict",hmmDir.c_str());
args.add(argvtmp);
args.add("-phnfn");
argvtmp=(char*)malloc(255*sizeof(char));
sprintf(argvtmp,"%s/phone",hmmDir.c_str());
args.add(argvtmp);
args.add("-mapfn");
argvtmp=(char*)malloc(255*sizeof(char));
sprintf(argvtmp,"%s/map",hmmDir.c_str());
args.add(argvtmp);
args.add("-hmmdir");
argvtmp=(char*)malloc(255*sizeof(char));
sprintf(argvtmp,"%s/",hmmDir.c_str());
args.add(argvtmp);
args.add("-hmmdirlist");
argvtmp=(char*)malloc(255*sizeof(char));
sprintf(argvtmp,"%s",hmmDir.c_str());
args.add(argvtmp);
args.add("-8bsen TRUE");
args.add("-sendumpfn");
argvtmp=(char*)malloc(255*sizeof(char));
sprintf(argvtmp,"%s/sendump",hmmDir.c_str());
args.add(argvtmp);
args.add("-cbdir");
argvtmp=(char*)malloc(255*sizeof(char));
sprintf(argvtmp,"%s",hmmDir.c_str());
args.add(argvtmp);
fbs_init(args.argc(), args.argv());
std::list<std::string>::iterator fit, lmit; //file iterator; lm iterator
for (fit = newLmFileNames.begin(), lmit = newLmNames.begin();
fit != newLmFileNames.end();
fit = newLmFileNames.begin(), lmit = newLmNames.begin())
{
if (lm_read((*fit).c_str(), (*lmit).c_str(), 7.0, .5, 6.5) != 0)
{
cerr << "[SphinxSpeechTask] Error: Could not read lm file " << (*fit) << endl;
//.........这里部分代码省略.........