本文整理汇总了C++中ice::CommunicatorPtr类的典型用法代码示例。如果您正苦于以下问题:C++ CommunicatorPtr类的具体用法?C++ CommunicatorPtr怎么用?C++ CommunicatorPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CommunicatorPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main (int argc, char* argv[]) {
int status;
Ice::CommunicatorPtr ic;
try {
ic = Ice::initialize(argc, argv);
// Contact to Encoders
Ice::ObjectPrx Encoders = ic->propertyToProxy("automata.Encoders.Proxy");
if (Encoders == 0)
throw "Could not create proxy with Encoders";
Encodersprx = jderobot::EncodersPrx::checkedCast(Encoders);
if (Encodersprx == 0)
throw "Invalid proxy automata.Encoders.Proxy";
std::cout << "Encoders connected" << std::endl;
// Contact to Motors
Ice::ObjectPrx Motors = ic->propertyToProxy("automata.Motors.Proxy");
if (Motors == 0)
throw "Could not create proxy with Motors";
Motorsprx = jderobot::MotorsPrx::checkedCast(Motors);
if (Motorsprx == 0)
throw "Invalid proxy automata.Motors.Proxy";
std::cout << "Motors connected" << std::endl;
automatagui = new AutomataGui(argc, argv);
displayAutomataGui = showAutomataGui();
pthread_create(&thr_sub_1, NULL, &subautomata_1, NULL);
pthread_join(thr_sub_1, NULL);
if (displayAutomataGui)
pthread_join(thr_automatagui, NULL);
} catch ( const Ice::Exception& ex ) {
std::cerr << ex << std::endl;
status = 1;
} catch ( const char* msg ) {
std::cerr << msg << std::endl;
status = 1;
}
if (ic)
ic->destroy();
return status;
}
示例2: ServantLocatorAMDI
int
run(int, char**, const Ice::CommunicatorPtr& communicator)
{
communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
communicator->getProperties()->setProperty("Ice.Warn.Dispatch", "0");
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
adapter->addServantLocator(new ServantLocatorAMDI(""), "");
adapter->addServantLocator(new ServantLocatorAMDI("category"), "category");
adapter->add(new TestAMDI, communicator->stringToIdentity("asm"));
adapter->add(new TestActivationI, communicator->stringToIdentity("test/activation"));
adapter->activate();
TEST_READY
adapter->waitForDeactivate();
return EXIT_SUCCESS;
}
示例3: main
int main(int argc, char** argv) {
int status;
cameraview::colorTuner viewer;
Ice::CommunicatorPtr ic;
try {
ic = EasyIce::initialize(argc,argv);
Ice::ObjectPrx base = ic->propertyToProxy("Cameraview.Camera.Proxy");
if (0==base)
throw "Could not create proxy";
/*cast to CameraPrx*/
jderobot::CameraPrx cprx = jderobot::CameraPrx::checkedCast(base);
if (0==cprx)
throw "Invalid proxy";
while(viewer.isVisible()) {
jderobot::ImageDataPtr data = cprx->getImageData(colorspaces::ImageRGB8::FORMAT_RGB8.get()->name);
cv::Mat image = cv::Mat(cv::Size(data->description->width,data->description->height),CV_8UC3,&(data->pixelData[0]));
colorspaces::Image::FormatPtr fmt = colorspaces::Image::Format::searchFormat(data->description->format);
if (!fmt)
throw "Format not supported";
viewer.display(image);
image.release();
}
} catch (const Ice::Exception& ex) {
std::cerr << ex << std::endl;
status = 1;
} catch (const char* msg) {
std::cerr << msg << std::endl;
status = 1;
}
if (ic)
ic->destroy();
return status;
}
示例4: Dispatcher
int
main(int argc, char* argv[])
{
int status;
Ice::CommunicatorPtr communicator;
try
{
Ice::InitializationData initData;
initData.properties = Ice::createProperties(argc, argv);
#ifdef ICE_CPP11
Ice::DispatcherPtr dispatcher = new Dispatcher();
initData.dispatcher = Ice::newDispatcher(
[=](const Ice::DispatcherCallPtr& call, const Ice::ConnectionPtr& conn)
{
dispatcher->dispatch(call, conn);
});
#else
initData.dispatcher = new Dispatcher();
#endif
communicator = Ice::initialize(argc, argv, initData);
status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
{
cerr << ex << endl;
status = EXIT_FAILURE;
}
if(communicator)
{
try
{
communicator->destroy();
}
catch(const Ice::Exception& ex)
{
cerr << ex << endl;
status = EXIT_FAILURE;
}
}
Dispatcher::terminate();
return status;
}
示例5: gui
int
main(int argc, char* argv[])
{
int status = 0;
int count=0;
Ice::CommunicatorPtr ic;
GUI gui(argc, argv);
try {
ic = Ice::initialize(argc, argv);
Ice::ObjectPrx base = ic->stringToProxy("AirportInterface:default -p 10000");
if (!base)
throw "Invalid base";
ATCDisplay::AirportInterfacePrx airportsim = ATCDisplay::AirportInterfacePrx::checkedCast(base);
if (!airportsim)
throw "Invalid proxy";
int milisec = 100; // length of time to sleep, in miliseconds
struct timespec req;
req.tv_sec = 0;
req.tv_nsec = milisec * 1000000L;
//while(1)
//std::cout<<airportsim->getPoints()<<std::endl;
gui.init(airportsim);
gui.run();
} catch (const Ice::Exception& ex) {
cerr << ex << endl;
status = 1;
} catch (const char* msg) {
cerr << msg << endl;
status = 1;
}
if (ic)
ic->destroy();
return status;
}
示例6: run
int
main(int argc, char* argv[])
{
#ifdef ICE_STATIC_LIBS
Ice::registerIceSSL();
#endif
int status;
Ice::CommunicatorPtr communicator;
try
{
Ice::InitializationData initData;
initData.properties = Ice::createProperties(argc, argv);
initData.properties->setProperty("Ice.Warn.Dispatch", "0");
initData.properties->setProperty("Ice.Warn.Connections", "0");
initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
initData.properties->setProperty("Ice.MessageSizeMax", "10"); // 10KB max
initData.properties->setProperty("TestAdapter2.Endpoints", "default -p 12011");
initData.properties->setProperty("TestAdapter2.MessageSizeMax", "0");
initData.properties->setProperty("TestAdapter3.Endpoints", "default -p 12012");
initData.properties->setProperty("TestAdapter3.MessageSizeMax", "1");
communicator = Ice::initialize(argc, argv, initData);
status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
{
cerr << ex << endl;
status = EXIT_FAILURE;
}
if(communicator)
{
try
{
communicator->destroy();
}
catch(const Ice::Exception& ex)
{
cerr << ex << endl;
status = EXIT_FAILURE;
}
}
return status;
}
示例7: init
// ######################################################################
void PrimaryMotorCortexI::init(Ice::CommunicatorPtr ic, Ice::ObjectAdapterPtr adapter)
{
Ice::ObjectPtr pmcPtr = this;
itsObjectPrx = adapter->add(pmcPtr,
ic->stringToIdentity("PrimaryMotorCortex"));
IceStorm::TopicPrx topicPrx;
itsTopicsSubscriptions.push_back(SimEventsUtils::TopicInfo("ActionMessageTopic", topicPrx));
SimEventsUtils::initSimEvents(ic, itsObjectPrx, itsTopicsSubscriptions);
Ice::ObjectPrx base = ic->stringToProxy(
"IRobotService:default -p 10000 -h roomba");
itsRobot = Robots::IRobotPrx::checkedCast(base);
if(!itsRobot) LFATAL("Invalid Robot Proxy");
itsRobot->sendStart();
itsRobot->setMode(Robots::SafeMode);
}
示例8: allTests
int
run(int, char**, const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPtr& observer)
{
communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint(communicator, 0));
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
adapter->add(ICE_MAKE_SHARED(MetricsI), Ice::stringToIdentity("metrics"));
//adapter->activate(); // Don't activate OA to ensure collocation is used.
communicator->getProperties()->setProperty("ControllerAdapter.Endpoints", getTestEndpoint(communicator, 1));
Ice::ObjectAdapterPtr controllerAdapter = communicator->createObjectAdapter("ControllerAdapter");
controllerAdapter->add(ICE_MAKE_SHARED(ControllerI, adapter), Ice::stringToIdentity("controller"));
//controllerAdapter->activate(); // Don't activate OA to ensure collocation is used.
MetricsPrxPtr allTests(const Ice::CommunicatorPtr&, const CommunicatorObserverIPtr&);
MetricsPrxPtr metrics = allTests(communicator, observer);
metrics->shutdown();
return EXIT_SUCCESS;
}
示例9: allTests
int
run(int, char**, const Ice::CommunicatorPtr& communicator)
{
Ice::ObjectFactoryPtr factory = new MyObjectFactory;
communicator->addObjectFactory(factory, "::Test::B");
communicator->addObjectFactory(factory, "::Test::C");
communicator->addObjectFactory(factory, "::Test::D");
communicator->addObjectFactory(factory, "::Test::E");
communicator->addObjectFactory(factory, "::Test::F");
communicator->addObjectFactory(factory, "::Test::I");
communicator->addObjectFactory(factory, "::Test::J");
communicator->addObjectFactory(factory, "::Test::H");
InitialPrx allTests(const Ice::CommunicatorPtr&);
InitialPrx initial = allTests(communicator);
initial->shutdown();
return EXIT_SUCCESS;
}
示例10: setSpeeds
void MainWindow::setSpeeds(Ice::CommunicatorPtr ic){
Ice::PropertiesPtr prop = ic->getProperties();
this->max_x = std::atof( prop->getPropertyWithDefault("UAVViewer.Xmax", "0.3").c_str() );
this->max_y = std::atof( prop->getPropertyWithDefault("UAVViewer.Ymax", "0.3").c_str() );
this->max_z = std::atof( prop->getPropertyWithDefault("UAVViewer.Zmax", "0.3").c_str() );
this->max_yaw = std::atof( prop->getPropertyWithDefault("UAVViewer.Yawmax", "0.3").c_str() );
}
示例11: ClientError
Glacier2::RouterPrx const client::getRouter(const Ice::CommunicatorPtr& comm) const {
Ice::RouterPrx prx = comm->getDefaultRouter();
if ( ! prx ) {
throw omero::ClientError(__FILE__,__LINE__,"No default router found.");
}
Glacier2::RouterPrx router = Glacier2::RouterPrx::checkedCast(prx);
if ( ! router ) {
throw ClientError(__FILE__, __LINE__, "Error obtaining Glacier2 router");
}
// For whatever reason, we have to set the context
// on the router context here as well.
router = Glacier2::RouterPrx::uncheckedCast(router->ice_context(comm->getImplicitContext()->getContext()));
return router;
}
示例12: getTestEndpoint
int
run(int, char**, const Ice::CommunicatorPtr& communicator)
{
communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint(communicator, 0));
communicator->getProperties()->setProperty("TestAdapter.ACM.Timeout", "0");
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
Ice::Identity id = Ice::stringToIdentity("communicator");
adapter->add(ICE_MAKE_SHARED(RemoteCommunicatorI), id);
adapter->activate();
TEST_READY
// Disable ready print for further adapters.
communicator->getProperties()->setProperty("Ice.PrintAdapterReady", "0");
communicator->waitForShutdown();
return EXIT_SUCCESS;
}
示例13: initialize
void MyUtil::initialize() {
ServiceI& service = ServiceI::instance();
service.getAdapter()->add(&FeedFocusInvertI::instance(), service.createIdentity(
"M", ""));
Ice::CommunicatorPtr communicator = service.getCommunicator();
int mod = communicator->getProperties()->getPropertyAsInt( "FeedFocusInvert.Mod");
int interval = communicator->getProperties()->getPropertyAsIntWithDefault( "FeedFocusInvert.Interval", 5);
xce::serverstate::ServerStateSubscriber::instance().initialize( "ControllerFeedFocusInvertR", &FeedFocusInvertI::instance(), mod, interval,
new XceFeedChannel());
//register 2 controller
xce::feed::serverstate::FeedServerStateSubscriber::instance().initialize( "ControllerFeedFocusInvertR", &FeedFocusInvertI::instance(), mod, interval,
new XceFeedControllerChannel());
MCE_INFO("MyUtil::initialize. mod:" << mod << " interval:" << interval);
TaskManager::instance().scheduleRepeated(&FeedFocusInvertStatTimer::instance());
}
示例14:
int
run(int, char**, const Ice::CommunicatorPtr& communicator)
{
communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12010");
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
adapter->add(ICE_MAKE_SHARED(MetricsI), Ice::stringToIdentity("metrics"));
adapter->activate();
communicator->getProperties()->setProperty("ControllerAdapter.Endpoints", "default -p 12011");
Ice::ObjectAdapterPtr controllerAdapter = communicator->createObjectAdapter("ControllerAdapter");
controllerAdapter->add(ICE_MAKE_SHARED(ControllerI, adapter), Ice::stringToIdentity("controller"));
controllerAdapter->activate();
TEST_READY
communicator->waitForShutdown();
return EXIT_SUCCESS;
}
示例15: initMotors
Thread_control::Thread_control(Ice::CommunicatorPtr ic, KobukiManager* kobuki_manager)
{
this->ic = ic;
prop = ic->getProperties();
this->kobuki_manager = kobuki_manager;
initMotors();
initEncoders();
}