void ServerAMD::run(int argc, char** argv) { Ice::PropertiesPtr properties = createTestProperties(argc, argv); properties->setProperty("Ice.Warn.Connections", "0"); properties->setProperty("Ice.Warn.Dispatch", "0"); Ice::CommunicatorHolder communicator = initialize(argc, argv, properties); communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint()); Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter"); adapter->add(ICE_MAKE_SHARED(MyDerivedClassI), Ice::stringToIdentity("test")); adapter->activate(); serverReady(); communicator->waitForShutdown(); }
void ServerAMD::run(int argc, char** argv) { Ice::PropertiesPtr properties = createTestProperties(argc, argv); #ifndef ICE_CPP11_MAPPING properties->setProperty("Ice.CollectObjects", "1"); #endif Ice::CommunicatorHolder communicator = initialize(argc, argv, properties); communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint()); Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter"); adapter->add(ICE_MAKE_SHARED(InitialI), Ice::stringToIdentity("initial")); adapter->activate(); serverReady(); communicator->waitForShutdown(); }
void Server::run(int argc, char** argv) { Ice::PropertiesPtr properties = createTestProperties(argc, argv); #if TARGET_OS_IPHONE != 0 // // COMPILERFIX: Disable connect timeout introduced for // workaround to iOS device hangs when using SSL // properties->setProperty("Ice.Override.ConnectTimeout", ""); #endif // // This test kills connections, so we don't want warnings. // properties->setProperty("Ice.Warn.Connections", "0"); // // The client sends large messages to cause the transport // buffers to fill up. // properties->setProperty("Ice.MessageSizeMax", "20000"); // // Limit the recv buffer size, this test relies on the socket // send() blocking after sending a given amount of data. // properties->setProperty("Ice.TCP.RcvSize", "50000"); Ice::CommunicatorHolder communicator = initialize(argc, argv, properties); communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint()); communicator->getProperties()->setProperty("ControllerAdapter.Endpoints", getTestEndpoint(1)); communicator->getProperties()->setProperty("ControllerAdapter.ThreadPool.Size", "1"); Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter"); adapter->add(ICE_MAKE_SHARED(TimeoutI), Ice::stringToIdentity("timeout")); adapter->activate(); Ice::ObjectAdapterPtr controllerAdapter = communicator->createObjectAdapter("ControllerAdapter"); controllerAdapter->add(ICE_MAKE_SHARED(ControllerI, adapter), Ice::stringToIdentity("controller")); controllerAdapter->activate(); serverReady(); communicator->waitForShutdown(); }
Ice::PropertiesPtr initializeProperties(Ice::StringSeq args, Ice::PropertiesPtr properties){ properties->parseIceCommandLineOptions(args); std::string iceconfigs = properties->getProperty("Ice.Config"); if (!iceconfigs.empty()){ for (std::string iceconfig : std::split(iceconfigs, ",")) loadIceConfig(iceconfig, properties); } properties->parseCommandLineOptions("", args); return properties; }
int LibraryServer::run(int argc, char*[]) { if(argc > 1) { cerr << appName() << ": too many arguments" << endl; return EXIT_FAILURE; } Ice::PropertiesPtr properties = communicator()->getProperties(); // // Create an object adapter // Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("Library"); // // Create an evictor for books. // Freeze::EvictorPtr evictor = Freeze::createBackgroundSaveEvictor(adapter, _envName, "books"); Ice::Int evictorSize = properties->getPropertyAsInt("EvictorSize"); if(evictorSize > 0) { evictor->setSize(evictorSize); } // // Use the evictor as servant Locator. // adapter->addServantLocator(evictor, "book"); // // Create the library, and add it to the object adapter. // LibraryIPtr library = new LibraryI(communicator(), _envName, "authors", evictor); adapter->add(library, Ice::stringToIdentity("library")); // // Create and install a factory for books. // Ice::ValueFactoryPtr bookFactory = new BookFactory(library); communicator()->getValueFactoryManager()->add(bookFactory, Demo::Book::ice_staticId()); // // Everything ok, let's go. // shutdownOnInterrupt(); adapter->activate(); communicator()->waitForShutdown(); ignoreInterrupt(); return EXIT_SUCCESS; }
int main(int argc, char* argv[]){ Ice::CommunicatorPtr ic = EasyIce::initialize(argc, argv); Ice::PropertiesPtr prop = ic->getProperties(); prop->setProperty("Test.Adapter.Endpoints", "tcp -h localhost -p 65000"); Ice::ObjectPtr obj = new IceMX::Metrics(); Ice::ObjectAdapterPtr adapter = ic->createObjectAdapter("Test.Adapter"); adapter->add(obj, ic->stringToIdentity("metric")); std::cout<<"\n### EXAMPLE with easyiceconfig::proxies::createProxy() ###"<<std::endl; /// Exception due empty proxy try{ easyiceconfig::proxies::createProxy<IceMX::MetricsPrx>(ic, "Test.Proxy", false); } catch (Ice::ProxyParseException ex){ std::cout<<"Expected ProxyParseException\n"<<ex<<std::endl; } IceMX::MetricsPrx pxr; /// All ok (1) /// Proxy from string do not create entry at Properties pxr = easyiceconfig::proxies::createProxy<IceMX::MetricsPrx>(ic, "metric:tcp -h localhost -p 65000", true); easyiceconfig::debug::printProperties(prop); /// All ok (2) prop->setProperty("Test.Proxy", "metric:tcp -h localhost -p 65000"); pxr = easyiceconfig::proxies::createProxy<IceMX::MetricsPrx>(ic, "Test.Proxy", false); easyiceconfig::debug::printProperties(prop); // Using it std::cout << "Gathering some info" << std::endl; std::cout << pxr->ice_id() << std::endl; std::cout << pxr->ice_toString() << std::endl; std::cout<<"\n### EXAMPLE with EasyIce::EasyProxy ###"<<std::endl; EasyIce::EasyProxy<IceMX::MetricsPrx> proxy(ic, "bad endpoint definition", true); if (proxy){ //do stuff }else std::cout<<proxy.exception()<<std::endl; // copying EasyIce::EasyProxy<IceMX::MetricsPrx> p2; p2 = EasyIce::EasyProxy<IceMX::MetricsPrx>(ic, "bad endpoint definition", true); try{ p2 = EasyIce::createProxy<IceMX::MetricsPrx>(ic, "bad endpoint definition", true); }catch(Ice::Exception){} ic->shutdown(); }
int main(int argc, char** argv){ killed=false; struct sigaction sigIntHandler; sigIntHandler.sa_handler = exitApplication; sigemptyset(&sigIntHandler.sa_mask); sigIntHandler.sa_flags = 0; sigaction(SIGINT, &sigIntHandler, NULL); Ice::PropertiesPtr prop; std::string componentPrefix("myComponent"); try{ ic = Ice::initialize(argc,argv); prop = ic->getProperties(); } catch (const Ice::Exception& ex) { std::cerr << ex << std::endl; return 1; } catch (const char* msg) { std::cerr <<"Error :" << msg << std::endl; return 1; } std::string Endpoints = prop->getProperty(componentPrefix + ".Endpoints"); Ice::ObjectAdapterPtr adapter =ic->createObjectAdapterWithEndpoints(componentPrefix, Endpoints); // for each interface: std::string objPrefix="myInterface"; std::string Name = "pointcloud1"; std::cout << "Creating pointcloud1 " << Name << std::endl; interface1 = new myClassI(); adapter->add(interface1, ic->stringToIdentity(Name)); //starting the adapter adapter->activate(); ic->waitForShutdown(); if (!killed) exitApplication(1); return 0; }
void MyUtil::initialize() { ServiceI& service = ServiceI::instance(); service.getAdapter()->add(&xce::ad::AdUnionAdminI::instance(), service.createIdentity("M", "")); Ice::PropertiesPtr props = service.getCommunicator()->getProperties(); string fcgi_socket = props->getPropertyWithDefault("Service." + service.getName() + ".FcgiSocket", "0.0.0.0:9001"); MCE_INFO("Fcgi listens on : " << fcgi_socket); FcgiServer * fcgi_server = new FcgiServer(fcgi_socket, 4); fcgi_server->RegisterRequestFactory(new xce::ad::AdminRequestFactory()); fcgi_server->Start(); }
void MyUtil::initialize() { ServiceI& service = ServiceI::instance(); Ice::PropertiesPtr props = service.getCommunicator()->getProperties(); // service.getObjectCache()->registerCategory(kUserPageCacheIndex, "USER_PAGE", new UserPageFactoryI, props, true); service.getAdapter()->add(&PageCacheManagerI::instance(), service.createIdentity("M", "")); InitMonitorLogger(ServiceI::instance().getName(), "monitor", "../log/" + ServiceI::instance().getName() + "/monitor/monitor_log", "INFO"); string fcgi_socket = props->getPropertyWithDefault("Service." + service.getName() + ".FcgiSocket", "0.0.0.0:9001"); MCE_INFO("Fcgi listens on : " << fcgi_socket); FcgiServer * fcgi_server = new FcgiServer(fcgi_socket, 128); fcgi_server->RegisterRequestFactory(new PageCacheRequestFactory()); fcgi_server->Start(); }
UserFeedsI::UserFeedsI() { ServiceI& service = ServiceI::instance(); Ice::PropertiesPtr props = service.getCommunicator()->getProperties(); checker_limit_ = ITEM_COUNT_LIMIT; checker_interval_ = props->getPropertyAsIntWithDefault("Service." + service.getName() + ".CheckerInterval", 10); build_history_ = props->getPropertyAsIntWithDefault("Service." + service.getName() + ".BuildHistory", 1);//单位为天 15->1 build_interval_ = props->getPropertyAsIntWithDefault("Service." + service.getName() + ".BuildInterval", 20);//单位为分钟 checker_ = new CheckerTimerTask(fs_, checker_limit_); timer_.scheduleRepeated(checker_, IceUtil::Time::seconds(checker_interval_)); }
int run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) { Ice::PropertiesPtr properties = communicator->getProperties(); properties->setProperty("Ice.Warn.Dispatch", "0"); communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter"); Ice::ObjectPtr object = new ThrowerI(); adapter->add(object, communicator->stringToIdentity("thrower")); adapter->activate(); communicator->waitForShutdown(); return EXIT_SUCCESS; }
int run(int, char**, const Ice::CommunicatorPtr& communicator) { Ice::PropertiesPtr properties = communicator->getProperties(); properties->setProperty("Ice.Warn.Dispatch", "0"); communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint(communicator, 0) + " -t 2000"); Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter"); adapter->add(ICE_MAKE_SHARED(TestI), Ice::stringToIdentity("Test")); adapter->activate(); TEST_READY communicator->waitForShutdown(); return EXIT_SUCCESS; }
int main(int argc, char* argv[]) { if (argc < 3) { cerr << "tmcli <endpoint> <command> ..." << endl; return -1; } try { Ice::PropertiesPtr properties = Ice::createProperties(); properties->load("../etc/admin.cfg"); InitializationData initializationData; initializationData.properties = properties; CommunicatorPtr communicator = initialize(initializationData); ObjectPrx object = communicator->stringToProxy("TMA@"+string(argv[1])); TaskManagerAPIPrx manager = TaskManagerAPIPrx::uncheckedCast(object); if (string(argv[2]) == "clear") { if (argc != 4) { help(); return -1; } int level = boost::lexical_cast<int>(argv[3]); manager->clear(level); } else if (string(argv[2]) == "size") { if (argc != 4) { help(); return -1; } int level = boost::lexical_cast<int>(argv[3]); cout << manager->size(level) << endl; } else if (string(argv[2]) == "config") { if (argc != 7) { help(); return -1; } int level = boost::lexical_cast<int>(argv[3]); int min = boost::lexical_cast<int>(argv[4]); int max = boost::lexical_cast<int>(argv[5]); int stack = boost::lexical_cast<int>(argv[6]); manager->config(level, min, max, stack); } else { help(); } } catch (const Ice::Exception& e) { cerr << e.what() << endl; return -1; } catch (...) { cerr << "unknown exception" << endl; return -1; } return 0; }
int main(int argc, char** argv) { Ice::ObjectPtr viewerPtr; //signal(SIGINT,signalHandler); Ice::CommunicatorPtr ic; try{ ic = EasyIce::initialize(argc, argv); Ice::PropertiesPtr prop = ic->getProperties(); std::string Endpoints = prop->getProperty("Visualization.Endpoints"); // Naming Service int nsActive = prop->getPropertyAsIntWithDefault("NamingService.Enabled", 0); if (nsActive) { std::string ns_proxy = prop->getProperty("NamingService.Proxy"); try { namingService = new jderobot::ns(ic, ns_proxy); } catch (Ice::ConnectionRefusedException& ex) { jderobot::Logger::getInstance()->error("Impossible to connect with NameService!"); exit(-1); } } Ice::ObjectAdapterPtr adapter =ic->createObjectAdapterWithEndpoints("Visualization", Endpoints); std::string objPrefix("Visualization."); std::string viewerName = prop->getProperty(objPrefix + "Name"); Ice::ObjectPtr object = new visualization::VisualizationI(objPrefix, ic); adapter->add(object, ic->stringToIdentity(viewerName)); if (namingService) namingService->bind(viewerName, Endpoints, object->ice_staticId()); adapter->activate(); ic->waitForShutdown(); }catch (const Ice::Exception& ex) { std::cerr << ex<<" 1 " << std::endl; exit(-1); } catch (const char* msg) { std::cerr << msg<< " 2 " << std::endl; exit(-1); } }
void ControllerI::activateObjectAdapter(const string& name, const string& adapterId, const string& replicaGroupId, const Ice::Current& current) { Ice::CommunicatorPtr communicator = current.adapter->getCommunicator(); Ice::PropertiesPtr properties = communicator->getProperties(); properties->setProperty(name + ".AdapterId", adapterId); properties->setProperty(name + ".ReplicaGroupId", replicaGroupId); properties->setProperty(name + ".Endpoints", "default"); _adapters[name] = communicator->createObjectAdapter(name); _adapters[name]->activate(); }
FrequencyAnalyzer::FrequencyAnalyzer() : Analyzer() { ServiceI& service = ServiceI::instance(); Ice::PropertiesPtr prop = service.getCommunicator()->getProperties(); _configMap = prop->getPropertiesForPrefix("FrequencyAnalyzer"); /*stringstream stream(prop->getProperty("Mobile")); string mobile; while (stream >> mobile) { _alert->addMobile(mobile); }*/ _time = prop->getPropertyAsIntWithDefault("FrequencyAnalyzer.Time", 60); _size = prop->getPropertyAsIntWithDefault("FrequencyAnalyzer.Size", 6); }
Ice::ObjectAdapterPtr RegistryI::setupClientSessionFactory(const Ice::ObjectAdapterPtr& registryAdapter, const IceGrid::LocatorPrx& locator) { Ice::PropertiesPtr properties = _communicator->getProperties(); Ice::ObjectAdapterPtr adapter; SessionServantManagerPtr servantManager; if(!properties->getProperty("IceGrid.Registry.SessionManager.Endpoints").empty()) { adapter = _communicator->createObjectAdapter("IceGrid.Registry.SessionManager"); servantManager = new SessionServantManager(adapter, _instanceName, false, "", 0, 0); adapter->addServantLocator(servantManager, ""); } assert(_reaper); _timer = new IceUtil::Timer(); // Used for for session allocation timeout. _clientSessionFactory = new ClientSessionFactory(servantManager, _database, _timer, _reaper); if(servantManager && _master) // Slaves don't support client session manager objects. { Identity sessionMgrId; sessionMgrId.category = _instanceName; sessionMgrId.name = "SessionManager"; Identity sslSessionMgrId; sslSessionMgrId.category = _instanceName; sslSessionMgrId.name = "SSLSessionManager"; adapter->add(new ClientSessionManagerI(_clientSessionFactory), sessionMgrId); adapter->add(new ClientSSLSessionManagerI(_clientSessionFactory), sslSessionMgrId); _wellKnownObjects->add(adapter->createProxy(sessionMgrId), Glacier2::SessionManager::ice_staticId()); _wellKnownObjects->add(adapter->createProxy(sslSessionMgrId), Glacier2::SSLSessionManager::ice_staticId()); } if(adapter) { Ice::Identity dummy; dummy.name = "dummy"; _wellKnownObjects->addEndpoint("SessionManager", adapter->createDirectProxy(dummy)); } _clientVerifier = getPermissionsVerifier(registryAdapter, locator, "IceGrid.Registry.PermissionsVerifier", properties->getProperty("IceGrid.Registry.CryptPasswords")); _sslClientVerifier = getSSLPermissionsVerifier(locator, "IceGrid.Registry.SSLPermissionsVerifier"); return adapter; }
Controller::Controller(Ice::PropertiesPtr prop, int w, int h, int nCameras) { cameras.resize(nCameras); this->gladepath = resourcelocator::findGladeFile("rgbdManualCalibrator.glade"); this->world = prop->getProperty("rgbdManualCalibrator.World.File"); //cout << "world es " << this->world << endl; this->camOut = prop->getProperty("rgbdManualCalibrator.Camera.FileOut"); cWidth=w; cHeight=h; this->drawCenter = false; /*Init world and configurations*/ this->nCameras=nCameras; this->init(prop, nCameras); }
// Client verbosity bool CascadeDetectI::initialize( const DetectorProperties& detprops, const FilePath& model, const Current& current) { // Create DetectorPropertiesI class to allow the user to modify detection // parameters mDetectorProps = new DetectorPropertiesI(); // Get the default CVAC data directory as defined in the config file localAndClientMsg(VLogger::DEBUG, NULL, "Initializing CascadeDetector...\n"); Ice::PropertiesPtr iceprops = (current.adapter->getCommunicator()->getProperties()); string verbStr = iceprops->getProperty("CVAC.ServicesVerbosity"); if (!verbStr.empty()) { getVLogger().setLocalVerbosityLevel( verbStr ); } if(model.filename.empty()) { if (!gotModel) { localAndClientMsg(VLogger::ERROR, NULL, "No trained model available, aborting.\n" ); return false; } // ok, go on with pre-configured model } else { string modelfile = getFSPath( model, m_CVAC_DataDir ); localAndClientMsg( VLogger::DEBUG_1, NULL, "initializing with %s\n", modelfile.c_str()); gotModel = readModelFile( modelfile, current ); if (!gotModel) { localAndClientMsg(VLogger::ERROR, NULL, "Failed to initialize because explicitly specified trained model " "cannot be found or loaded: %s\n", modelfile.c_str()); return false; } } localAndClientMsg(VLogger::INFO, NULL, "CascadeDetector initialized.\n"); // Set the default window size to what the cascade was trained as. // User can override this by passing in properties in the process call. cv::Size orig = cascade->getOriginalWindowSize(); // Default to size trained with mDetectorProps->nativeWindowSize.width = orig.width; mDetectorProps->nativeWindowSize.height = orig.height; return true; }
MurmurIce::MurmurIce() { count = 0; if (meta->mp.qsIceEndpoint.isEmpty()) return; Ice::PropertiesPtr ipp = Ice::createProperties(); ::Meta::mp.qsSettings->beginGroup("Ice"); foreach(const QString &v, ::Meta::mp.qsSettings->childKeys()) { ipp->setProperty(u8(v), u8(::Meta::mp.qsSettings->value(v).toString())); } ::Meta::mp.qsSettings->endGroup(); Ice::PropertyDict props = ippProperties->getPropertiesForPrefix(""); Ice::PropertyDict::iterator i; for (i=props.begin(); i != props.end(); ++i) { ipp->setProperty((*i).first, (*i).second); } ipp->setProperty("Ice.ImplicitContext", "Shared"); Ice::InitializationData idd; idd.properties = ipp; try { communicator = Ice::initialize(idd); if (! meta->mp.qsIceSecretWrite.isEmpty()) { ::Ice::ImplicitContextPtr impl = communicator->getImplicitContext(); if (impl) impl->put("secret", u8(meta->mp.qsIceSecretWrite)); } adapter = communicator->createObjectAdapterWithEndpoints("Murmur", qPrintable(meta->mp.qsIceEndpoint)); MetaPtr m = new MetaI; MetaPrx mprx = MetaPrx::uncheckedCast(adapter->add(m, communicator->stringToIdentity("Meta"))); adapter->addServantLocator(new ServerLocator(), "s"); iopServer = new ServerI; adapter->activate(); foreach(const Ice::EndpointPtr ep, mprx->ice_getEndpoints()) { qWarning("MurmurIce: Endpoint \"%s\" running", qPrintable(u8(ep->toString()))); } meta->connectListener(this); } catch (Ice::Exception &e) { qCritical("MurmurIce: Initialization failed: %s", qPrintable(u8(e.ice_name()))); } }
void ThreadIce::run() { try { Ice::PropertiesPtr props = Ice::createProperties(); props->setProperty( "client_adapter.Endpoints", "tcp" ); Ice::InitializationData initData; initData.properties = props; m_comm = Ice::initialize( initData ); m_adapter = m_comm->createObjectAdapterWithEndpoints( "adapter", m_listen ); m_factory = new FactoryIce( this, m_mainWnd ); m_adapter->add( m_factory, m_comm->stringToIdentity( "factory" ) ); m_adapter->activate(); m_mutex.lock(); m_status = "connected"; m_mutex.unlock(); m_semaphore.lock(); m_semaphore.notifyAll(); m_semaphore.unlock(); m_comm->waitForShutdown(); m_comm->destroy(); } catch(const Ice::Exception& ex) { m_errors.push( ex.ice_name() ); if( m_comm ) { try { m_comm->destroy(); } catch(const Ice::Exception& ex) { m_errors.push( ex.ice_name() ); } } } m_mutex.lock(); m_status = "disconnected"; m_mutex.unlock(); m_semaphore.lock(); m_semaphore.notifyAll(); m_semaphore.unlock(); }
InternalRegistryI::InternalRegistryI(const RegistryIPtr& registry, const DatabasePtr& database, const ReapThreadPtr& reaper, const WellKnownObjectsManagerPtr& wellKnownObjects, ReplicaSessionManager& session) : _registry(registry), _database(database), _reaper(reaper), _wellKnownObjects(wellKnownObjects), _fileCache(new FileCache(database->getCommunicator())), _session(session) { Ice::PropertiesPtr properties = database->getCommunicator()->getProperties(); _nodeSessionTimeout = properties->getPropertyAsIntWithDefault("IceGrid.Registry.NodeSessionTimeout", 30); _replicaSessionTimeout = properties->getPropertyAsIntWithDefault("IceGrid.Registry.ReplicaSessionTimeout", 30); }
ClientSessionFactory::ClientSessionFactory(const SessionServantManagerPtr& servantManager, const DatabasePtr& database, const IceUtil::TimerPtr& timer, const ReapThreadPtr& reaper) : _servantManager(servantManager), _database(database), _timer(timer), _reaper(reaper), _filters(false) { if(_servantManager) // Not set if Glacier2 session manager adapter not enabled { Ice::PropertiesPtr properties = _database->getCommunicator()->getProperties(); const_cast<bool&>(_filters) = properties->getPropertyAsIntWithDefault("IceGrid.Registry.SessionFilters", 0) > 0; } }
int main(int argc, char** argv){ Ice::CommunicatorPtr ic; Ice::PropertiesPtr prop; std::string prefix("replayController."); try{ ic = EasyIce::initialize(argc,argv); prop = ic->getProperties(); }catch (const Ice::Exception& ex) { std::cerr << ex << std::endl; return 1; } catch (const char* msg) { std::cerr <<"Error :" << msg << std::endl; return 1; } jderobot::ReplayControlerClientHDLPtr replayController( new jderobot::ReplayControlerClientHDL(ic,prefix+"control.Proxy",false)); if (!replayController->getProxy()) exit(-1); int ips=prop->getPropertyAsIntWithDefault(prefix+"IPS",10); float cycle=(float)(1/(float)ips)*1000000; replayController::replayControllergui* gui = new replayController::replayControllergui(replayController); struct timeval post; long long int totalpre=0; long long int totalpost=0; while (gui->update()){ gettimeofday(&post,NULL); totalpost=post.tv_sec*1000000+post.tv_usec; if (totalpre !=0){ if ((totalpost - totalpre) > cycle ){ std::cout<<"-------- replayController: camera adquisition timeout-" << std::endl; } else{ usleep(cycle - (totalpost - totalpre)); } } totalpre=totalpost; } }
LaserI::LaserI(Ice::PropertiesPtr prop) { std::string model = prop->getProperty("Laser.Model"); if ("Hokuyo"==model || "hokuyo"==model){ std::string deviceId = prop->getProperty("Laser.DeviceId"); double min = (double)prop->getPropertyAsInt("Laser.MinAng"); double max = (double)prop->getPropertyAsInt("Laser.MaxAng"); int clustering = prop->getPropertyAsInt("Laser.Clustering"); int faceup = prop->getPropertyAsInt("Laser.FaceUp"); double min_ang = min*M_PI/180; double max_ang = max*M_PI/180; this->manager = new hokuyo::HokuyoManager(deviceId, min_ang, max_ang, clustering, -1, faceup); }else{ throw std::invalid_argument( model + " laser is not allowed" ); } }
BOOL CPatchDlg::OnInitDialog() { CDialog::OnInitDialog(); // Set the icon for this dialog. The framework does this automatically // when the application's main window is not a dialog SetIcon(_hIcon, TRUE); // Set big icon SetIcon(_hIcon, FALSE); // Set small icon // // Retrieve the controls. // _path = (CEdit*)GetDlgItem(IDC_PATH); _thorough = (CButton*)GetDlgItem(IDC_THOROUGH); _remove = (CButton*)GetDlgItem(IDC_ORPHAN); _select = (CButton*)GetDlgItem(IDC_SELECTDIR); _start = (CButton*)GetDlgItem(IDC_STARTPATCH); _cancel = (CButton*)GetDlgItem(IDC_CANCELPATCH); _file = (CStatic*)GetDlgItem(IDC_FILE); _total = (CStatic*)GetDlgItem(IDC_TOTAL); _speed = (CStatic*)GetDlgItem(IDC_SPEED); _status = (CStatic*)GetDlgItem(IDC_STATUSBAR); _percent = (CStatic*)GetDlgItem(IDC_PERCENT); _progress = (CProgressCtrl*)GetDlgItem(IDC_PROGRESS); // // Set the patch directory and thorough flag from properties. // Ice::PropertiesPtr properties = _communicator->getProperties(); CString path = IceUtil::stringToWstring(properties->getPropertyWithDefault("IcePatch2.Directory", "")).c_str(); _path->SetWindowText(path); CString thorough = IceUtil::stringToWstring(properties->getPropertyWithDefault("IcePatch2.Thorough", "0")).c_str(); _thorough->SetCheck(thorough != "0"); CString remove = IceUtil::stringToWstring(properties->getPropertyWithDefault("IcePatch2.Remove", "0")).c_str(); _remove->SetCheck(remove != "0"); // // Indicate ready status. // reset(L" Ready"); return TRUE; // return TRUE unless you set the focus to a control }
void MyUtil::initialize() { // static google_breakpad::ExceptionHandler eh(".", 0, MyCallback, 0, true); ServiceI& service = ServiceI::instance(); service.getAdapter()->add(&HotShareI::instance(), service.createIdentity("M", "")); Ice::PropertiesPtr props = service.getCommunicator()->getProperties(); string fcgi_socket = props->getPropertyWithDefault("Service." + service.getName() + ".FcgiSocket", "0.0.0.0:9001"); MCE_DEBUG("Fcgi listens on : " << fcgi_socket); TaskManager::instance().scheduleRepeated(&GetDataTimer::instance()); FcgiServer * fcgi_server = new FcgiServer(fcgi_socket, 64); fcgi_server->RegisterRequestFactory(new HotShareFactory()); fcgi_server->Start(); }
int run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) { Ice::PropertiesPtr properties = communicator->getProperties(); int num = argc == 2 ? atoi(argv[1]) : 0; ostringstream os; os << "tcp -p " << (12010 + num); properties->setProperty("ControlAdapter.Endpoints", os.str()); Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("ControlAdapter"); adapter->add(new TestIntfI, communicator->stringToIdentity("control")); adapter->activate(); if(num == 0) { properties->setProperty("TestAdapter.Endpoints", "udp -p 12010"); Ice::ObjectAdapterPtr adapter2 = communicator->createObjectAdapter("TestAdapter"); adapter2->add(new TestIntfI, communicator->stringToIdentity("test")); adapter2->activate(); } string endpoint; if(properties->getProperty("Ice.IPv6") == "1") { #if defined(__APPLE__) endpoint = "udp -h \"ff02::1:1\" -p 12020 --interface \"lo0\""; #else endpoint = "udp -h \"ff01::1:1\" -p 12020"; #endif } else { endpoint = "udp -h 239.255.1.1 -p 12020"; } properties->setProperty("McastTestAdapter.Endpoints", endpoint); Ice::ObjectAdapterPtr mcastAdapter = communicator->createObjectAdapter("McastTestAdapter"); mcastAdapter->add(new TestIntfI, communicator->stringToIdentity("test")); mcastAdapter->activate(); TEST_READY communicator->waitForShutdown(); return EXIT_SUCCESS; }
RemoteObjectAdapterPrx RemoteCommunicatorI::createObjectAdapter(int timeout, int close, int heartbeat, const Current& current) { Ice::CommunicatorPtr com = current.adapter->getCommunicator(); Ice::PropertiesPtr properties = com->getProperties(); string protocol = properties->getPropertyWithDefault("Ice.Default.Protocol", "tcp"); string host = properties->getPropertyWithDefault("Ice.Default.Host", "127.0.0.1"); string name = IceUtil::generateUUID(); if(timeout >= 0) { properties->setProperty(name + ".ACM.Timeout", toString(timeout)); } if(close >= 0) { properties->setProperty(name + ".ACM.Close", toString(close)); } if(heartbeat >= 0) { properties->setProperty(name + ".ACM.Heartbeat", toString(heartbeat)); } properties->setProperty(name + ".ThreadPool.Size", "2"); ObjectAdapterPtr adapter = com->createObjectAdapterWithEndpoints(name, protocol + " -h \"" + host + "\""); return RemoteObjectAdapterPrx::uncheckedCast(current.adapter->addWithUUID(new RemoteObjectAdapterI(adapter))); }
void RegistryI::setupAdminSessionFactory(const Ice::ObjectAdapterPtr& registryAdapter, const Ice::ObjectAdapterPtr& sessionManagerAdapter, const IceGrid::LocatorPrx& locator, bool nowarn) { assert(_reaper); _adminSessionFactory = new AdminSessionFactory(sessionManagerAdapter, _database, _reaper, this); if(sessionManagerAdapter) { Identity adminSessionMgrId; adminSessionMgrId.category = _instanceName; adminSessionMgrId.name = "AdminSessionManager"; Identity sslAdmSessionMgrId; sslAdmSessionMgrId.category = _instanceName; sslAdmSessionMgrId.name = "AdminSSLSessionManager"; if(!_master) { adminSessionMgrId.name += "-" + _replicaName; sslAdmSessionMgrId.name += "-" + _replicaName; } sessionManagerAdapter->add(new AdminSessionManagerI(_adminSessionFactory), adminSessionMgrId); sessionManagerAdapter->add(new AdminSSLSessionManagerI(_adminSessionFactory), sslAdmSessionMgrId); _wellKnownObjects->add(sessionManagerAdapter->createProxy(adminSessionMgrId), Glacier2::SessionManager::ice_staticId()); _wellKnownObjects->add(sessionManagerAdapter->createProxy(sslAdmSessionMgrId), Glacier2::SSLSessionManager::ice_staticId()); } Ice::PropertiesPtr properties = _communicator->getProperties(); _adminVerifier = getPermissionsVerifier(registryAdapter, locator, "IceGrid.Registry.AdminPermissionsVerifier", properties->getProperty("IceGrid.Registry.AdminCryptPasswords"), nowarn); _sslAdminVerifier = getSSLPermissionsVerifier(locator, "IceGrid.Registry.AdminSSLPermissionsVerifier", nowarn); }