这篇教程C++ ACE_ARGV类代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中ACE_ARGV类的典型用法代码示例。如果您正苦于以下问题:C++ ACE_ARGV类的具体用法?C++ ACE_ARGV怎么用?C++ ACE_ARGV使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。 在下文中一共展示了ACE_ARGV类的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: ACE_TMAINintACE_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;}
开发者ID:CCJY,项目名称:ACE,代码行数:60,
示例2: ACE_TMAINintACE_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;}
开发者ID:asdlei00,项目名称:ACE,代码行数:58,
示例3: test_simple_argvstatic inttest_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;}
开发者ID:CCJY,项目名称:ACE,代码行数:29,
示例4: GetLogLevel//初始化日志策略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;}
开发者ID:0328shijian,项目名称:PSS,代码行数:54,
示例5: avintImR_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;}
开发者ID:opensourcecodeformyself,项目名称:ATCD,代码行数:14,
示例6: ACE_NEW_RETURNACE_ARGV*Lorica::Config::get_ifr_options_copy(void){ ACE_ARGV *args; ACE_NEW_RETURN(args, ACE_ARGV(), 0); ssize_t len = this->ifr_args_.size(); for (ssize_t count = 0; count < len; count++) args->add (this->ifr_args_[count].c_str()); return args;}
开发者ID:colding,项目名称:lorica,代码行数:14,
示例7: Enable3dControlsBOOL 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;}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:46,
示例8: avintImR_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;}
开发者ID:rushgun,项目名称:ATCD,代码行数:17,
示例9: ACE_TRACE/// Dynamically link the shared object file and retrieve a pointer to/// the designated shared object in this file.intACE_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;}
开发者ID:Adeer,项目名称:OregonCore,代码行数:45,
示例10: argumentsintHandle_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;}
开发者ID:azraelly,项目名称:knetwork,代码行数:19,
示例11: svr_workervoid *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;}
开发者ID:asdlei00,项目名称:ACE,代码行数:38,
示例12: run_mainintrun_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;}
开发者ID:asdlei00,项目名称:ACE,代码行数:24,
示例13: ACE_TMAINintACE_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;}
开发者ID:asdlei00,项目名称:ACE,代码行数:53,
示例14: run_mainintrun_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;}
开发者ID:INMarkus,项目名称:ATCD,代码行数:41,
示例15: ACE_MT// ****************************************************************/// Note that the argument vector will be corrupted upon returnintTAO::ORB::open_global_services (int argc, ACE_TCHAR **argv){ { // Count of the number of (times we did this for all) ORBs. static int orb_init_count = 0; // Using ACE_Static_Object_Lock::instance() precludes ORB_init() // from being called within a static object CTOR. ACE_MT (ACE_GUARD_RETURN (TAO_SYNCH_RECURSIVE_MUTEX, guard, *ACE_Static_Object_Lock::instance (), -1)); // Make sure TAO's singleton manager is initialized. // We need to initialize before TAO_default_environment() is called // since that call instantiates a TAO_TSS_Singleton. if (TAO_Singleton_Manager::instance ()->init () == -1) return -1; // Prevent multiple initializations. if (++orb_init_count > 1) return 0; } // Prevent any other thread from going through ORB initialization before the // uber-gestalt is initialized. ACE_MT (ACE_GUARD_RETURN (TAO_SYNCH_RECURSIVE_MUTEX, guard, TAO_Ubergestalt_Ready_Condition::instance ()->mutex (), -1)); if (TAO_debug_level > 2) { TAOLIB_DEBUG ((LM_DEBUG, ACE_TEXT ("TAO (%P|%t) Initializing the ") ACE_TEXT ("process-wide service context/n"))); } ACE_Service_Gestalt* theone = ACE_Service_Config::global (); ACE_Service_Config_Guard auto_config_guard (theone); // Construct an argument vector specific to the process-wide // (global) Service Configurator instance. // Be certain to copy the program name so that service configurator // has something to skip! ACE_ARGV global_svc_config_argv (true); // only this ctor allows // subsequent use of add()! global_svc_config_argv.add ((argc <= 0 || argv == 0) ? ACE_TEXT ("") : argv[0], true); // Will expand the environment variables, if any were used. // Is this a good thing? I guess it provides greater flexibility // for deployment,so let's leave it. Will also quote arguments. ACE_ARGV copyargv (argc, argv, true, true); // Adjust to proper type int tmpargc = copyargv.argc (); // use copied count, not original ACE_Argv_Type_Converter cvtargv (tmpargc, copyargv.argv()); tmpargc = cvtargv.get_argc (); ACE_TCHAR **tmpargv = cvtargv.get_TCHAR_argv (); // Collect global SC parameters. True means "immediately // apply global setting" like debug flag, etc. if (parse_global_args_i (tmpargc, tmpargv, global_svc_config_argv, true) == -1) return -1; bool skip_service_config_open = false; // by default we shouldn't if (using_global_gestalt_i (tmpargc, tmpargv, skip_service_config_open)) { if (parse_svcconf_args_i (tmpargc, tmpargv, global_svc_config_argv) == -1) return -1; } bool ignore_default_svc_conf_file = false; if (parse_private_args_i (tmpargc, tmpargv, global_svc_config_argv, skip_service_config_open, ignore_default_svc_conf_file) == -1) return -1; // register_global_services_i depends on the parsing of at least the // -ORBNegotiateCodesets option, and must be invoked after all the // parsing methods, but still must preceed the opening of other services. register_global_services_i (theone);//.........这里部分代码省略.........
开发者ID:chenbk85,项目名称:ACE-Middleware,代码行数:101,
示例16: throwvoid SthenoCore::open(ACE_ARGV& args) throw (RuntimeException&) { ACE_GUARD(ACE_SYNCH_RECURSIVE_MUTEX, ace_mon, m_lock); m_reservationFlag = false; m_runNO = 0; //no run m_testNO = 0; //no test m_trace = true; m_maxServicesQoS = 2; //m_runtimeQoS = 950000; //absolute // dont need this m_runtimeQoS = RUNTIME_DEFAULT_QOS; //5000; m_runtimePeriod = CPUReservation::DEFAULT_PERIOD; //signal handling ACE_Sig_Action no_sigpipe((ACE_SignalHandler) SIG_IGN); ACE_Sig_Action original_action; no_sigpipe.register_action(SIGPIPE, &original_action); static const ACE_TCHAR options[] = ACE_TEXT("::"); const char* prefix = "/0"; ACE_Get_Opt cmd_opts(args.argc(), args.argv(), options); int option; if (cmd_opts.long_option (ACE_TEXT("prefix"), ACE_Get_Opt::ARG_REQUIRED) == -1) { throw RuntimeException(RuntimeException::INVALID_ARGS); } if (cmd_opts.long_option (ACE_TEXT("run"), ACE_Get_Opt::ARG_REQUIRED) == -1) { throw RuntimeException(RuntimeException::INVALID_ARGS); } if (cmd_opts.long_option (ACE_TEXT("test"), ACE_Get_Opt::ARG_REQUIRED) == -1) { throw RuntimeException(RuntimeException::INVALID_ARGS); } if (cmd_opts.long_option (ACE_TEXT("reservation"), ACE_Get_Opt::ARG_REQUIRED) == -1) { throw RuntimeException(RuntimeException::INVALID_ARGS); } if (cmd_opts.long_option (ACE_TEXT("maxservices"), ACE_Get_Opt::ARG_REQUIRED) == -1) { throw RuntimeException(RuntimeException::INVALID_ARGS); } if (cmd_opts.long_option (ACE_TEXT("runtimeqos"), ACE_Get_Opt::ARG_REQUIRED) == -1) { throw RuntimeException(RuntimeException::INVALID_ARGS); } if (cmd_opts.long_option (ACE_TEXT("runtimeqosperiod"), ACE_Get_Opt::ARG_REQUIRED) == -1) { throw RuntimeException(RuntimeException::INVALID_ARGS); } printf("AGRS=%d/n", args.argc()); while ((option = cmd_opts()) != EOF) switch (option) { case 0: { //long_option const char *op = cmd_opts.long_option(); printf("LONG=%s/n", cmd_opts.opt_arg()); if (ACE_OS::strcmp("prefix", op) == 0) { prefix = cmd_opts.opt_arg(); printf("Prefix=%s/n", prefix); break; } if (ACE_OS::strcmp("run", op) == 0) { m_runNO = Integer::parseInt(cmd_opts.opt_arg(), 10); printf("RunNo=%d %s/n", m_runNO, cmd_opts.opt_arg()); break; } if (ACE_OS::strcmp("test", op) == 0) { m_testNO = Integer::parseInt(cmd_opts.opt_arg(), 10); printf("TestNo=%d %s/n", m_testNO, cmd_opts.opt_arg()); break; } if (ACE_OS::strcmp("reservation", op) == 0) { if (strcasecmp(cmd_opts.opt_arg(), "true") == 0) { m_reservationFlag = true; } break; } if (ACE_OS::strcmp("maxservices", op) == 0) { m_maxServicesQoS = Integer::parseInt(cmd_opts.opt_arg(), 10); break; } if (ACE_OS::strcmp("runtimeqos", op) == 0) { m_runtimeQoS = Integer::parseInt(cmd_opts.opt_arg(), 10); printf("runtimeqos=%d %s/n", m_runtimeQoS, cmd_opts.opt_arg()); break; }//.........这里部分代码省略.........
开发者ID:edenduthie,项目名称:rtft1,代码行数:101,
示例17: ACE_DEBUG //////////////////////////////////////////////////////////////////////// // 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;//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:miro-middleware-svn,代码行数:101,
示例18: mainintmain(int argc, char *argv[]){ // set up argv for CORBA init int i; for (i=0; i<argc; ++i) // search for -ORBSvcConf option if (strcmp("-ORBSvcConf", argv[i]) == 0) break; ACE_ARGV cl; // set up new argv cl.add(argv); // add main argv if (i == argc) // if no -ORBSvcConf file is specified, cl.add("-ORBSvcConf speech.conf"); // specify one#ifdef DEBUG cout << "Initialize server daemon." << endl;#endif Speech speech(cl.argc(), cl.argv()); for (int i = 1; i < argc; ++i) { if (strcmp(argv[i], "-SpeechInfo") == 0) { speech.speechImpl.connection.catInfo(); return 0; } if (strcmp(argv[i], "-SpeechSetIntro") == 0) { char buffer[256]; cin.getline(buffer, 256); speech.speechImpl.connection.setBootMessage(buffer); return 0; } } try {#ifdef DEBUG cout << "Loop forever handling events." << endl;#endif speech.run();#ifdef DEBUG cout << "Speech server ended, exiting." << endl;#endif } catch (const Miro::EDevIO& e) { cerr << "DevIO excetpion: Device access failed." << endl; return 1; } catch (const CORBA::Exception & e) { cerr << "Uncaught CORBA exception: " << e << endl; return 1; } catch (const Miro::ACE_Exception& e) { cerr << "ACE exception: " << e << endl; return 1; } catch (...) { cerr << "Uncaught exception: " << endl; return 1; } return 0;}
开发者ID:BackupTheBerlios,项目名称:miro-middleware-svn,代码行数:62,
示例19: ACE_TMAINintACE_TMAIN(int, ACE_TCHAR **argv){ int result = 0; ACE_TCHAR signum[64]; ACE_OS::sprintf(signum, ACE_TEXT("%d"), SIGUSR1); ACE_ARGV args; args.add(argv[0]); args.add(ACE_TEXT("-s")); args.add(signum); ACE_Service_Config &serviceConfig = *ACE_Service_Config::singleton (); result = serviceConfig.open (args.argc(), args.argv(), ACE_DEFAULT_LOGGER_KEY, true, // ignore_static_svcs = 1, true, // ignore_default_svc_conf_file = 0, false // ignore_debug_flag = 0 ); if(0 != result) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("serviceConfig.open failed/n"))); return result; } ACE_DEBUG ((LM_INFO, ACE_TEXT ("serviceConfig.open done/n"))); for(int i = 0; i < 5; ++i) { ACE_DEBUG ((LM_INFO, ACE_TEXT ("loadOrb .../n"))); result = loadOrb(serviceConfig); if(0 != result) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("loadOrb failed/n"))); return result; } ACE_DEBUG ((LM_INFO, ACE_TEXT ("loadOrb done/n"))); ACE_DEBUG ((LM_INFO, ACE_TEXT ("loadNotify .../n"))); result = loadNotify(serviceConfig); if(0 != result) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("loadNotify failed/n"))); return result; } ACE_DEBUG ((LM_INFO, ACE_TEXT ("loadNotify done/n"))); ACE_DEBUG ((LM_INFO, ACE_TEXT ("unloadNotify .../n"))); result = unloadNotify(serviceConfig); if(0 != result) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("unloadNotify failed/n"))); return result; } ACE_DEBUG ((LM_INFO, ACE_TEXT ("unloadNotify done/n"))); ACE_DEBUG ((LM_INFO, ACE_TEXT ("unloadOrb .../n"))); result = unloadOrb(serviceConfig); if(0 != result) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("unloadOrb failed/n"))); return result; } ACE_DEBUG ((LM_INFO, ACE_TEXT ("unloadOrb done/n"))); } ACE_DEBUG ((LM_INFO, ACE_TEXT ("serviceConfig.fini_svcs .../n"))); result = serviceConfig.fini_svcs(); if(0 != result) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("serviceConfig.fini_svcs failed/n"))); return result; } ACE_DEBUG ((LM_INFO, ACE_TEXT ("serviceConfig.fini_svcs done/n"))); ACE_DEBUG ((LM_INFO, ACE_TEXT ("serviceConfig.close .../n"))); result = serviceConfig.close(); if(0 != result) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("serviceConfig.close failed/n"))); return result; } ACE_DEBUG ((LM_INFO, ACE_TEXT ("serviceConfig.close done/n"))); return 0;}
开发者ID:CCJY,项目名称:ATCD,代码行数:89,
示例20: test_argv_quotesstatic inttest_argv_quotes (void){ const ACE_TCHAR *argv_const[] = { ACE_TEXT ("first without quotes"), ACE_TEXT ("'second in single quotes'"), ACE_TEXT ("/"third in double quotes/""), 0 }; ACE_TCHAR **argv = const_cast<ACE_TCHAR **> (argv_const); // The convoluted argv definition is to silence warnings from gcc 4.3, which // warns if the string-literals are not assigned to const char* and also // warns if the const char*[] is passed to the ACE_ARGV constructor as in // "args3" below. int argc = 3; // (argc, argv) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("/n*** argv ***/n"))); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("argc: %d/n"), argc)); for (int i = 0; i < argc; ++i) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("argv[%02d] = %s/n"), i, argv[i])); // args ACE_ARGV args; for (int i = 0; i < argc; ++i) args.add (argv[i]); args.add (ACE_TEXT ("'fourth in single quotes'")); args.add (ACE_TEXT ("/"fifth in double quotes/"")); args.add (ACE_TEXT ("sixth without any quotes")); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("/n*** args-1 ***/n"))); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("args.argc (): %d/n"), args.argc ())); for (int i = 0; i < args.argc (); ++i) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("args[%02d]: %s/n"), i, args[i])); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("args.argc (): %d/n"), args.argc ())); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("/n*** args-2 ***/n"))); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("args.argc (): %d/n"), args.argc ())); for (int i = 0; i < args.argc (); ++i) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("args.argv ()[%02d]: %s/n"), i, args.argv ()[i])); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("args.argc (): %d/n"), args.argc ())); // args2 ACE_ARGV args2; for (int i = 0; i < argc; ++i) args2.add (argv[i], true); args2.add (ACE_TEXT ("'fourth in single quotes'"), true); args2.add (ACE_TEXT ("/"fifth in double quotes/""), true); args2.add (ACE_TEXT ("sixth without any quotes"), true); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("/n*** args-3 ***/n"))); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("args.argc (): %d/n"), args2.argc ())); for (int i = 0; i < args2.argc (); ++i) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("args[%02d]: %s/n"), i, args2[i])); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("args.argc (): %d/n"), args2.argc ())); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("/n*** args-4 ***/n"))); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("args.argc (): %d/n"), args2.argc ())); for (int i = 0; i < args2.argc (); ++i) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("args.argv ()[%02d]: %s/n"), i, args2.argv ()[i])); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("args.argc (): %d/n"), args2.argc ())); // args3 ACE_ARGV args3 (argv); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("/n*** args-5 ***/n"))); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("args.argc (): %d/n"), args3.argc ())); for (int i = 0; i < args3.argc (); ++i) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("args[%02d]: %s/n"), i, args3[i])); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("args.argc (): %d/n"), args3.argc ())); return 0;}
开发者ID:CCJY,项目名称:ACE,代码行数:86,
示例21: ACE_TMAINintACE_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;}
开发者ID:INMarkus,项目名称:ATCD,代码行数:50,
示例22: worker_parent// This function runs the parent process in a separate worker thread.static ACE_THR_FUNC_RETURNworker_parent (void *arg){ long handle_signals_synchronously = reinterpret_cast <long> (arg); ACE_Process_Options options; ACE_TCHAR *l_argv[3]; ACE_TCHAR pid_str[100]; // Store the parent's process id so we can pass it to the child // portably. Also, pass the test number, as well. ACE_OS::sprintf (pid_str, ACE_TEXT ("-p %ld -t %d"), static_cast <long> (parent_pid), test_number); // We're going to create a new process that runs this program again, // so we need to indicate that it's the child. const ACE_TCHAR *t = ACE_TEXT (".") ACE_DIRECTORY_SEPARATOR_STR ACE_TEXT ("%sSignal_Test") ACE_PLATFORM_EXE_SUFFIX ACE_TEXT (" -c"); l_argv[0] = const_cast <ACE_TCHAR *> (t); l_argv[1] = pid_str; l_argv[2] = 0; ACE_ARGV argv (l_argv); // Generate a command-line! ACE_TString exe_sub_dir; const char *subdir_env = ACE_OS::getenv ("ACE_EXE_SUB_DIR"); if (subdir_env) { exe_sub_dir = ACE_TEXT_CHAR_TO_TCHAR (subdir_env); exe_sub_dir += ACE_DIRECTORY_SEPARATOR_STR; } options.command_line (argv.buf (), exe_sub_dir.c_str ()); ACE_Process pm; child_pid = pm.spawn (options); if (child_pid == ACE_INVALID_PID) ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) spawning child process failed/n"), 0); else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) spawning child process %d/n"), child_pid)); // Perform a <wait> until our child process has exited. if (handle_signals_synchronously) { int status; // Wait for the child process to exit. pm.wait (&status); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) reaped child with status %d/n"), status)); } else while (shut_down == 0) { // Wait for a signal to arrive. if (ACE_OS::sigsuspend (0) == -1 && errno != EINTR) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p/n"), ACE_TEXT ("sigsuspend"))); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) got signal!/n"))); } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) parent worker done/n"))); return 0;}
开发者ID:PGSeungminLee,项目名称:CGSF,代码行数:78,
示例23: ACE_TMAINintACE_TMAIN(int, ACE_TCHAR ** argv){ int result = 0;#if !defined (ACE_LACKS_FORK) ACE_Sig_Action sigUSR2((ACE_SignalHandler) shutdown_func, SIGUSR2); ACE_DEBUG ((LM_INFO, ACE_TEXT ("(%P|%t) SIGUSR2 shutdown handler installed/n"))); ACE_UNUSED_ARG(sigUSR2); pid_t pid = -1; pid = ACE_OS::fork(); ACE_Log_Msg::instance ()->sync (argv[0]); // Make %P|%t work right if (pid == 0) // child { ACE_DEBUG ((LM_INFO, ACE_TEXT ("(%P|%t) child waiting/n"))); ACE_OS::sleep(5); ACE_DEBUG ((LM_INFO, ACE_TEXT ("(%P|%t) signaling parent/n"))); result = ACE_OS::kill(ACE_OS::getppid(), SIGUSR2); ACE_DEBUG ((LM_INFO, ACE_TEXT ("(%P|%t) signaled parent/n"))); // ACE_OS::sleep (100000); return 0; } else if (pid > 0) // parent { ACE_DEBUG ((LM_INFO, ACE_TEXT ("(%P|%t) parent using ACE_Service_Config, pid=%d/n"), pid)); ACE_Service_Config serviceConfig; ACE_TCHAR signum[64]; ACE_OS::sprintf(signum, ACE_TEXT("%d"), SIGUSR1); ACE_ARGV args; args.add(argv[0]); args.add(ACE_TEXT("-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"))); ACE_DEBUG ((LM_INFO, ACE_TEXT ("(%P|%t) serviceConfig.process_file .../n")));#if (ACE_USES_CLASSIC_SVC_CONF == 1) result = serviceConfig.process_file(ACE_TEXT("Bug_3251.conf"));#else result = serviceConfig.process_file(ACE_TEXT("Bug_3251.conf.xml"));#endif if(0 != result) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) Error: serviceConfig.process_file failed/n"))); return result; } ACE_DEBUG ((LM_INFO, ACE_TEXT ("(%P|%t) serviceConfig.process_file done/n"))); ACE_DEBUG ((LM_INFO, ACE_TEXT ("run_event_loop .../n"))); while(!bShutdown) { ACE_OS::last_error(0); result = ACE_Reactor::run_event_loop(); // reenter loop on EINTR if(0 != result && EINTR == ACE_OS::last_error()) { if(bShutdown) break; } else if(0 != result) { ACE_DEBUG (( LM_INFO, ACE_TEXT ("(%P|%t) run_event_loop failed (%s, %d)/n"), ACE_OS::strerror(ACE_OS::last_error()), ACE_OS::last_error() )); } } ACE_DEBUG ((LM_INFO, ACE_TEXT ("(%P|%t) run_event_loop done/n"))); ACE_DEBUG ((LM_INFO, ACE_TEXT ("(%P|%t) serviceConfig.fini_svcs .../n"))); result = serviceConfig.fini_svcs(); if(0 != result) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) Error: serviceConfig.fini_svcs failed/n"))); return result; } ACE_DEBUG ((LM_INFO, ACE_TEXT ("(%P|%t) serviceConfig.fini_svcs done/n"))); ACE_DEBUG ((LM_INFO, ACE_TEXT ("(%P|%t) serviceConfig.close .../n"))); result = serviceConfig.close(); if(0 != result)//.........这里部分代码省略.........
开发者ID:asdlei00,项目名称:ACE,代码行数:101,
示例24: testBug1459inttestBug1459 (int, ACE_TCHAR *[]){ ACE_TRACE ("testBug1459"); try { int n, error = 0; ACE_ARGV argM (argStrM); n = argM.argc (); CORBA::ORB_var ORBM = CORBA::ORB_init (n, argM.argv ()); if (CORBA::is_nil (ORBM.in ())) ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Expected to get an ORB/n")), -1);#if TAO_HAS_UIOP == 1 // UIOP ACE_ARGV argA (argStrA); n = argA.argc (); CORBA::ORB_var ORBA = CORBA::ORB_init (n, argA.argv ()); if (CORBA::is_nil (ORBA.in ())) ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Expected to get an ORB/n")), -1);#endif /* TAO_HAS_UIOP */#if defined (DO_1459_SSLIOP_TEST) // SSLIOP ACE_ARGV argB (argStrB); n = argB.argc (); CORBA::ORB_var ORBB = CORBA::ORB_init (n, argB.argv ()); if (CORBA::is_nil (ORBB.in ())) ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Expected to get an ORB/n")), -1);#endif // MIOP ACE_ARGV argC (argStrC); n = argC.argc (); CORBA::ORB_var ORBC = CORBA::ORB_init (n, argC.argv ()); if (CORBA::is_nil (ORBC.in ())) ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Expected to get an ORB/n")), -1); // DIOP ACE_ARGV argD (argStrD); n = argD.argc (); CORBA::ORB_var ORBD = CORBA::ORB_init (n, argD.argv ()); if (CORBA::is_nil (ORBD.in ())) ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Expected to get an ORB/n")), -1); if (// SSLIOP#if defined (DO_1459_SSLIOP_TEST) ORBM.in () == ORBB.in () ||#if TAO_HAS_UIOP == 1 ORBA.in () == ORBB.in () ||#endif ORBC.in () == ORBB.in () || ORBD.in () == ORBB.in () ||#endif// UIOP#if TAO_HAS_UIOP ORBM.in () == ORBA.in () || ORBC.in () == ORBA.in () || ORBD.in () == ORBA.in () ||#endif// MIOP ORBM.in () == ORBC.in () || ORBD.in () == ORBC.in () ||// DIOP ORBM.in () == ORBD.in () ) ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Unexpected to find the two ORBs are the same/n")), -1); // Since each svc conf file causes the ORB to load the services in // its own service space no services are reachable through the // global service repo#if TAO_HAS_UIOP == 1 // UIOP ACE_Service_Object *uiop_so =//.........这里部分代码省略.........
开发者ID:chenbk85,项目名称:ACE-Middleware,代码行数:101,
示例25: parse_argsstatic intparse_args (int test_number, int ordering, const ACE_TCHAR *test_args, int skip_argv = 1, int report_errors = 1, const ACE_TString &opt_prefix = empty_string){ ACE_TString test; ACE_TString optstring (opt_prefix); // Test the skip_argv for the first test only. if (skip_argv > 0) { test = ACE_TEXT ("Test_"); ACE_TCHAR s[20]; test += ACE_OS::itoa (test_number, s, 10); test += ACE_TEXT (" "); } test += test_args; optstring += ACE_TEXT ("fr:o::sW;"); ACE_DEBUG ((LM_INFO, ACE_TEXT (" TEST %d *****************************************") ACE_TEXT ("*******************/n"), test_number)); ACE_DEBUG ((LM_INFO, " Command line: /"%s/"/n", test.c_str ())); ACE_ARGV args (test.c_str ()); ACE_Get_Opt get_opt (args.argc (), args.argv (), optstring.c_str (), skip_argv, report_errors, ordering); // Now add the default long args. if (get_opt.long_option (ACE_TEXT ("flag"), 'f', ACE_Get_Opt::NO_ARG) != 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT (" Unable to add long option 'f'/n")), 1); if (get_opt.long_option (ACE_TEXT ("requires_arg"), 'r', ACE_Get_Opt::ARG_REQUIRED) != 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT (" Unable to add long option 'r'/n")), 1); if (get_opt.long_option (ACE_TEXT ("optional_arg"), 'o', ACE_Get_Opt::ARG_OPTIONAL) != 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT (" Unable to add long option 'o'/n")), 1); if (get_opt.long_option (ACE_TEXT ("long_option"), 'l', ACE_Get_Opt::ARG_OPTIONAL) != 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT (" Unable to add long option 'l'/n")), 1); if (get_opt.long_option (ACE_TEXT ("long_only"), -11, ACE_Get_Opt::ARG_REQUIRED) != 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT (" Unable to add long option ") ACE_TEXT ("/"long_only/"/n")), 1); if (get_opt.long_option (ACE_TEXT ("long_no_arg")) != 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT (" Unable to add long option ") ACE_TEXT ("/"long_no_arg/"/n")), 1); // This is the special case of providing a non-alpha numeric corresponding // short option. This lets you use the corresponding short option in a // switch statement, even thought a meaningful short options isn't available // (afterall, there are only so many alpha numeric characters available). if (get_opt.long_option (ACE_TEXT ("non_alpha-num_short"), -10, ACE_Get_Opt::ARG_OPTIONAL) != 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT (" Unable to add long option ") ACE_TEXT ("/"non_alpha_short/"/n")), 1); // We print out the optstring here because adding long_options that // have corresponding short options that aren't yet present, are added. ACE_DEBUG ((LM_INFO, ACE_TEXT (" optstring: /"%s/" skip_argv: %d/n"), get_opt.optstring (), skip_argv)); // Now, let's parse it... int c = 0; while ((c = get_opt ()) != EOF) { switch (c) { case 0: // Long Option.//.........这里部分代码省略.........
开发者ID:asdlei00,项目名称:ACE,代码行数:101,
示例26: ACE_TEXT_RegOpenKeyExintTAO_NT_Notify_Service::init (int argc, ACE_TCHAR *argv[]){ HKEY hkey = 0; BYTE buf[ACE_DEFAULT_ARGV_BUFSIZ]; *buf = '/0'; // This solution is very kludgy. It looks in the NT Registry under // //HKEY_LOCAL_MACHINE/SOFTWARE/ACE/TAO for the value of // "TaoNotifyServiceOptions" for any Notify Service options such as // "-ORBEndpoint". // Get Notify Service options from the NT Registry. ACE_TEXT_RegOpenKeyEx (REGISTRY_KEY_ROOT, TAO_REGISTRY_SUBKEY, 0, KEY_READ, &hkey); DWORD type; DWORD bufSize = sizeof (buf); ACE_TEXT_RegQueryValueEx (hkey, TAO_NOTIFY_SERVICE_OPTS_NAME, 0, &type, buf, &bufSize); RegCloseKey (hkey); // Add options to the args list (if any). if (ACE_OS::strlen ((char *) buf) > 0) { ACE_ARGV args ((const char*) buf); // Allocate the internal args list to be one bigger than the // args list passed into the function. We use a 'save' list in // case we use a 'destructive' args list processor - this way we // maintain the correct argv and argc for memory freeing // operations in the destructor. argv_save_ = (ACE_TCHAR **) ACE_OS::malloc (sizeof (ACE_TCHAR *) * (argc + args.argc ())); // Copy the values into the internal args buffer. int i; for (i = 0; i < argc; i++) argv_save_[i] = ACE_OS::strdup (argv[i]); int j = 0; for (i = argc; i < static_cast<int> ((args.argc () + argc)); i++) argv_save_[i] = ACE_OS::strdup (args.argv ()[j++]); // Set the arg counter. argc_save_ = argc + args.argc (); argc_ = argc_save_; argv_ = argv_save_; } else { argc_ = argc; argv_ = argv; } return 0;}
开发者ID:esohns,项目名称:ATCD,代码行数:68,
示例27: ACE_TRACEintACE_Service_Config::parse_args_i (int argc, ACE_TCHAR *argv[]){ ACE_TRACE ("ACE_Service_Config::parse_args_i"); // Using PERMUTE_ARGS (default) in order to have all // unrecognized options and their value arguments moved // to the end of the argument vector. We'll pick them up // after processing our options and pass them on to the // base class for further parsing. //FUZZ: disable check_for_lack_ACE_OS ACE_Get_Opt getopt (argc, argv, ACE_TEXT ("bs:p:"), 1 , // Start at argv[1]. 0, // Do not report errors ACE_Get_Opt::RETURN_IN_ORDER); //FUZZ: enable check_for_lack_ACE_OS // Keep a list of all unknown arguments, begin with the // executable's name ACE_ARGV superargv; superargv.add (argv[0]); //FUZZ: disable check_for_lack_ACE_OS for (int c; (c = getopt ()) != -1; ) //FUZZ: enable check_for_lack_ACE_OS switch (c) { case 'p': ACE_Service_Config::pid_file_name_ = getopt.opt_arg (); break; case 'b': ACE_Service_Config::be_a_daemon_ = 1; break; case 's': { // There's no point in dealing with this on NT since it // doesn't really support signals very well...#if !defined (ACE_LACKS_UNIX_SIGNALS) ACE_Service_Config::signum_ = ACE_OS::atoi (getopt.opt_arg ()); if (ACE_Reactor::instance ()->register_handler (ACE_Service_Config::signum_, ACE_Service_Config::signal_handler_) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("cannot obtain signal handler/n")), -1);#endif /* ACE_LACKS_UNIX_SIGNALS */ break; } default: superargv.add ( argv[getopt.opt_ind () - 1],true); } // Collect any argumets that were left for (int c = getopt.opt_ind (); c < argc; c++) superargv.add (argv[c-1],true); return ACE_Service_Gestalt::parse_args_i (superargv.argc (), superargv.argv ());} /* parse_args_i () */
开发者ID:eSDK,项目名称:eSDKClient_Soultion,代码行数:64,
注:本文中的ACE_ARGV类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ ACE_Acceptor类代码示例 C++ AArch64FunctionInfo类代码示例 |