• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ icestorm::TopicManagerPrx类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中icestorm::TopicManagerPrx的典型用法代码示例。如果您正苦于以下问题:C++ TopicManagerPrx类的具体用法?C++ TopicManagerPrx怎么用?C++ TopicManagerPrx使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了TopicManagerPrx类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: catch

ObserverTopic::ObserverTopic(const IceStorm::TopicManagerPrx& topicManager, const string& name, Ice::Long dbSerial) :
    _logger(topicManager->ice_getCommunicator()->getLogger()), _serial(0), _dbSerial(dbSerial)
{
    for(int i = 0; i < static_cast<int>(sizeof(encodings) / sizeof(Ice::EncodingVersion)); ++i)
    {
        ostringstream os;
        os << name << "-" << Ice::encodingVersionToString(encodings[i]);
        IceStorm::TopicPrx t;
        try
        {
            t = topicManager->create(os.str());
        }
        catch(const IceStorm::TopicExists&)
        {
            t = topicManager->retrieve(os.str());
        }

        //
        // NOTE: collocation optimization needs to be turned on for the
        // topic because the subscribe() method is given a fixed proxy
        // which can't be marshalled.
        //
        _topics[encodings[i]] = t->ice_collocationOptimized(true);
        _basePublishers.push_back(
            t->getPublisher()->ice_collocationOptimized(false)->ice_encodingVersion(encodings[i]));
    }
}
开发者ID:2008hatake,项目名称:zeroc-ice,代码行数:27,代码来源:Topics.cpp


示例2: exit

serverI::serverI(char* ipToSet, char *portToSet){

	port = portToSet;
	ip = ipToSet;
	ic = Ice::initialize();

	cout<<"----- Initialisation des fichiers audio :";
	if(initFiles())
		cout<<" OK"<<endl;	
	else{
		cerr << " Erreur" << endl;
		exit(1);
	}
        	
	cout<<"----- Initialisation du Topic :";

	// PREPARE TOPIC FOR PUBLISHING
	string topicName = "serv";
	
	Ice::ObjectPrx obj = ic->stringToProxy("server/TopicManager:tcp -h "+ip+" -p 10000");
	IceStorm::TopicManagerPrx manager = IceStorm::TopicManagerPrx::checkedCast(obj);
	if(!manager)
    	{

        exit(1);
    	}
	IceStorm::TopicPrx topic;
    try
    {
	   cout<<"OK"<<endl;
        topic = manager->retrieve(topicName);
    }
    catch(const IceStorm::NoSuchTopic&)
    {
        try
        {
		  cout<<"OK"<<endl;
            topic = manager->create(topicName);
        }
        catch(const IceStorm::TopicExists&)
        {
		  cout<<"Error"<<endl;
            exit(1);
        }
	}
	
    Ice::ObjectPrx publisher = topic->getPublisher();
    publisher = publisher->ice_oneway();
    serv = MonitorPrx::uncheckedCast(publisher);

    cout<<"----- Lancement du serveur "<<endl;
    initStreaming();
}
开发者ID:moktar84,项目名称:AudioServer,代码行数:53,代码来源:audioServer.cpp


示例3: communicator

int
Publisher::run(int argc, char* argv[])
{
    Ice::PropertiesPtr properties = communicator()->getProperties();

    IceStorm::TopicManagerPrx manager = 
        IceStorm::TopicManagerPrx::checkedCast(communicator()->stringToProxy("DemoIceStorm/TopicManager"));
    if(manager == 0)
    {
        cerr << appName() << ": no topic manager found, make sure application was deployed." << endl;
        return EXIT_FAILURE;
    }

    string topicName = "time";
    if(argc != 1)
    {
        topicName = argv[1];
    }

    IceStorm::TopicPrx topic;
    try
    {
        topic = manager->retrieve(topicName);
    }
    catch(const IceStorm::NoSuchTopic&)
    {
        cerr << appName() << ": topics not created yet, run subscriber." << endl;
        return EXIT_FAILURE;
    }

    //
    // Get the topic's publisher object, and configure a Clock proxy
    // with per-request load balancing.
    //
    ClockPrx clock = ClockPrx::uncheckedCast(topic->getPublisher()->ice_oneway()->ice_connectionCached(false));

    try
    {
        while(true)
        {
            clock->tick(IceUtil::Time::now().toDateTime());
            IceUtil::ThreadControl::sleep(IceUtil::Time::seconds(1));
        }
    }
    catch(const Ice::CommunicatorDestroyedException&)
    {
        // Ignore
    }

    return EXIT_SUCCESS;
}
开发者ID:updowndown,项目名称:myffff,代码行数:51,代码来源:Publisher.cpp


示例4: Startup

bool Publisher::Startup(void)
{
    this->IceInitialize();

    IceStorm::TopicManagerPrx manager;
    try {
        manager = IceStorm::TopicManagerPrx::checkedCast(this->IceCommunicator->propertyToProxy("TopicManager.Proxy"));
    } catch (const Ice::ConnectionRefusedException & e) {
        SCLOG_ERROR << PUBLISHER_INFO << "Failed to initialize IceStorm.  Check if IceBox is running: " << e.what() << std::endl;
        return false;
    }

    if (!manager) {
        SCLOG_ERROR << PUBLISHER_INFO << "Invalid proxy" << std::endl;
        return false;
    }

    // Retrieve the topic.
    IceStorm::TopicPrx topic;
    try {
        topic = manager->retrieve(this->TopicName);
    } catch(const IceStorm::NoSuchTopic&) {
        try {
            topic = manager->create(this->TopicName);
        }
        catch(const IceStorm::TopicExists&) {
            SCLOG_ERROR << PUBLISHER_INFO << "Topic not found. Try again." << std::endl;
            return false;
        }
    }

    // Get the topic's publisher object, and create topic proxy
    Ice::ObjectPrx publisher = topic->getPublisher();

    // Get the topic's publisher object, and create a proper proxy depending on
    // the topic.
    switch (this->Topic) {
    case Topic::CONTROL:
        PublisherControl = ControlPrx::uncheckedCast(publisher);
        break;
    case Topic::DATA:
        PublisherData = DataPrx::uncheckedCast(publisher);
        break;
    default:
        SCASSERT(false);
    }

    //BaseType::Startup();

    return true;
}
开发者ID:safecass,项目名称:safecass,代码行数:51,代码来源:publisher.cpp


示例5: appName

int
Server::run(int argc, char*[])
{
    if(argc > 1)
    {
        cerr << appName() << ": too many arguments" << endl;
        return EXIT_FAILURE;
    }

    Ice::PropertiesPtr properties = communicator()->getProperties();

    IceStorm::TopicManagerPrx manager = IceStorm::TopicManagerPrx::checkedCast(
        communicator()->propertyToProxy("TopicManager.Proxy"));
    if(!manager)
    {
        cerr << appName() << ": invalid proxy" << endl;
        return EXIT_FAILURE;
    }

    IceStorm::TopicPrx topic;
    try
    {
        topic = manager->retrieve("counter");
    }
    catch(const IceStorm::NoSuchTopic&)
    {
        try
        {
            topic = manager->create("counter");
        }
        catch(const IceStorm::TopicExists&)
        {
            cerr << appName() << ": topic exists, please try again." << endl;
            return EXIT_FAILURE;
        }
    }

    //
    // Create the servant to receive the events.
    //
    Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("Counter");
    Demo::CounterPtr counter = new CounterI(topic);
    adapter->add(counter, communicator()->stringToIdentity("counter"));
    adapter->activate();

    communicator()->waitForShutdown();

    return EXIT_SUCCESS;
}
开发者ID:2008hatake,项目名称:zeroc-ice,代码行数:49,代码来源:Server.cpp


示例6: catch

ReplicaCache::ReplicaCache(const Ice::CommunicatorPtr& communicator, const IceStorm::TopicManagerPrx& topicManager) :
    _communicator(communicator)
{
    IceStorm::TopicPrx t;
    try
    {
        t = topicManager->create("ReplicaObserverTopic");
    }
    catch(const IceStorm::TopicExists&)
    {
        t = topicManager->retrieve("ReplicaObserverTopic");
    }

    const_cast<IceStorm::TopicPrx&>(_topic) = IceStorm::TopicPrx::uncheckedCast(t->ice_collocationOptimized(true));
    const_cast<ReplicaObserverPrx&>(_observers) = ReplicaObserverPrx::uncheckedCast(_topic->getPublisher());
}
开发者ID:sbesson,项目名称:zeroc-ice,代码行数:16,代码来源:ReplicaCache.cpp


示例7: invalid_argument

void
Client::run(int argc, char** argv)
{
    Ice::CommunicatorHolder communicator = initialize(argc, argv);
    ObjectPrx base = communicator->stringToProxy("Test.IceStorm/TopicManager");
    IceStorm::TopicManagerPrx manager = IceStorm::TopicManagerPrx::checkedCast(base);
    if(!manager)
    {
        ostringstream os;
        os << argv[0] << ": `Test.IceStorm/TopicManager' is not running";
        throw invalid_argument(os.str());
    }

    ObjectAdapterPtr adapter = communicator->createObjectAdapterWithEndpoints("SingleAdapter", "default:udp");

    TopicPrx topic = manager->create("single");

    //
    // Create subscribers with different QoS.
    //
    SingleIPtr sub = new SingleI;
    topic->subscribeAndGetPublisher(IceStorm::QoS(), adapter->addWithUUID(sub));

    adapter->activate();

    // Ensure that getPublisher & getNonReplicatedPublisher work
    // correctly.
    Ice::ObjectPrx p1 = topic->getPublisher();
    Ice::ObjectPrx p2 = topic->getNonReplicatedPublisher();
    test(p1->ice_getAdapterId() == "PublishReplicaGroup");
    test(p2->ice_getAdapterId() == "Test.IceStorm1.Publish" ||
         p2->ice_getAdapterId() == "Test.IceStorm2.Publish" ||
         p2->ice_getAdapterId() == "Test.IceStorm3.Publish");

    //
    // Get a publisher object, create a twoway proxy and then cast to
    // a Single object.
    //
    SinglePrx single = SinglePrx::uncheckedCast(topic->getPublisher()->ice_twoway());
    for(int i = 0; i < 1000; ++i)
    {
        single->event(i);
    }

    sub->waitForEvents();
}
开发者ID:zeroc-ice,项目名称:ice-debian-packaging,代码行数:46,代码来源:Client.cpp


示例8: catch

int
run(int, char* argv[], const CommunicatorPtr& communicator)
{
    PropertiesPtr properties = communicator->getProperties();
    const char* managerProxyProperty = "IceStormAdmin.TopicManager.Default";
    string managerProxy = properties->getProperty(managerProxyProperty);
    if(managerProxy.empty())
    {
        cerr << argv[0] << ": property `" << managerProxyProperty << "' is not set" << endl;
        return EXIT_FAILURE;
    }

    IceStorm::TopicManagerPrx manager = IceStorm::TopicManagerPrx::checkedCast(
        communicator->stringToProxy(managerProxy));
    if(!manager)
    {
        cerr << argv[0] << ": `" << managerProxy << "' is not running" << endl;
        return EXIT_FAILURE;
    }

    TopicPrx topic;
    try
    {
        topic = manager->retrieve("single");
    }
    catch(const NoSuchTopic& e)
    {
        cerr << argv[0] << ": NoSuchTopic: " << e.name << endl;
        return EXIT_FAILURE;
        
    }
    assert(topic);

    //
    // Get a publisher object, create a twoway proxy and then cast to
    // a Single object.
    //
    SinglePrx single = SinglePrx::uncheckedCast(topic->getPublisher()->ice_twoway());
    for(int i = 0; i < 1000; ++i)
    {
        single->event(i);
    }

    return EXIT_SUCCESS;
}
开发者ID:pedia,项目名称:zeroc-ice,代码行数:45,代码来源:Publisher.cpp


示例9: if


//.........这里部分代码省略.........

        if(oldoption != option && oldoption != None)
        {
            usage(argv[0]);
            return EXIT_FAILURE;
        }
    }

    if(i != argc)
    {
        usage(argv[0]);
        return EXIT_FAILURE;
    }

    if(!retryCount.empty())
    {
        if(option == None)
        {
            option = Twoway;
        }
        else if(option != Twoway && option != Ordered)
        {
            cerr << argv[0] << ": retryCount requires a twoway proxy" << endl;
            return EXIT_FAILURE;
        }
    }

    if(batch && (option == Twoway || option == Ordered))
    {
        cerr << argv[0] << ": batch can only be set with oneway or datagram" << endl;
        return EXIT_FAILURE;
    }

    IceStorm::TopicManagerPrx manager = IceStorm::TopicManagerPrx::checkedCast(
        communicator()->propertyToProxy("TopicManager.Proxy"));
    if(!manager)
    {
        cerr << appName() << ": invalid proxy" << endl;
        return EXIT_FAILURE;
    }

    IceStorm::TopicPrx topic;
    try
    {  
        topic = manager->retrieve(topicName);
    }
    catch(const IceStorm::NoSuchTopic&)
    {
        try
        {
            topic = manager->create(topicName);
        }
        catch(const IceStorm::TopicExists&)
        {
            cerr << appName() << ": temporary failure. try again." << endl;
            return EXIT_FAILURE;
        }
    }

    Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("Clock.Subscriber");

    //
    // Add a servant for the Ice object. If --id is used the identity
    // comes from the command line, otherwise a UUID is used.
    //
    // id is not directly altered since it is used below to detect
开发者ID:pedia,项目名称:zeroc-ice,代码行数:67,代码来源:Subscriber.cpp


示例10: if

int
run(int argc, char* argv[], const CommunicatorPtr& communicator)
{
    bool batch = false;

    int idx = 1;
    while(idx < argc)
    {
        if(strcmp(argv[idx], "-b") == 0)
        {
            batch = true;

            for(int i = idx ; i + 1 < argc ; ++i)
            {
                argv[i] = argv[i + 1];
            }
            --argc;
        }
        else if(strcmp(argv[idx], "-h") == 0 || strcmp(argv[idx], "--help") == 0)
        {
            usage(argv[0]);
            return EXIT_SUCCESS;
        }
        else if(argv[idx][0] == '-')
        {
            cerr << argv[0] << ": unknown option `" << argv[idx] << "'" << endl;
            usage(argv[0]);
            return EXIT_FAILURE;
        }
    }

    PropertiesPtr properties = communicator->getProperties();
    const char* managerProxyProperty = "IceStormAdmin.TopicManager.Default";
    string managerProxy = properties->getProperty(managerProxyProperty);
    if(managerProxy.empty())
    {
        cerr << argv[0] << ": property `" << managerProxyProperty << "' is not set" << endl;
        return EXIT_FAILURE;
    }

    ObjectPrx base = communicator->stringToProxy(managerProxy);
    IceStorm::TopicManagerPrx manager = IceStorm::TopicManagerPrx::checkedCast(base);
    if(!manager)
    {
        cerr << argv[0] << ": `" << managerProxy << "' is not running" << endl;
        return EXIT_FAILURE;
    }

    ObjectAdapterPtr adapter = communicator->createObjectAdapterWithEndpoints("SubscriberAdapter", "default");
    EventIPtr eventFed1 = new EventI(communicator);

    //
    // Activate the servants.
    //
    ObjectPrx obj = adapter->addWithUUID(eventFed1);

    IceStorm::QoS qos;
    if(batch)
    {
        obj = obj->ice_batchOneway();
    }
    else
    {
        obj = obj->ice_oneway();
    }

    TopicPrx fed1;

    try
    {
        fed1 = manager->retrieve("fed1");
    }
    catch(const IceStorm::NoSuchTopic& e)
    {
        cerr << argv[0] << ": NoSuchTopic: " << e.name << endl;
        return EXIT_FAILURE;
    }

    fed1->subscribeAndGetPublisher(qos, obj);

    adapter->activate();

    communicator->waitForShutdown();

    fed1->unsubscribe(obj);

    return EXIT_SUCCESS;
}
开发者ID:2008hatake,项目名称:zeroc-ice,代码行数:88,代码来源:Subscriber.cpp


示例11: catch

int
run(int argc, char* argv[], const CommunicatorPtr& communicator)
{
    IceUtilInternal::Options opts;
    opts.addOpt("", "cycle");

    try
    {
        opts.parse(argc, (const char**)argv);
    }
    catch(const IceUtilInternal::BadOptException& e)
    {
        cerr << argv[0] << ": " << e.reason << endl;
        return EXIT_FAILURE;
    }

    PropertiesPtr properties = communicator->getProperties();
    const char* managerProxyProperty = "IceStormAdmin.TopicManager.Default";
    string managerProxy = properties->getProperty(managerProxyProperty);
    if(managerProxy.empty())
    {
        cerr << argv[0] << ": property `" << managerProxyProperty << "' is not set" << endl;
        return EXIT_FAILURE;
    }

    IceStorm::TopicManagerPrx manager = IceStorm::TopicManagerPrx::checkedCast(
        communicator->stringToProxy(managerProxy));
    if(!manager)
    {
        cerr << argv[0] << ": `" << managerProxy << "' is not running" << endl;
        return EXIT_FAILURE;
    }

    TopicPrx topic;
    while(true)
    {
        try
        {
            topic = manager->retrieve("single");
            break;
        }
        // This can happen if the replica group loses the majority
        // during retrieve. In this case we retry.
        catch(const Ice::UnknownException&)
        {
            continue;
        }
        catch(const IceStorm::NoSuchTopic& e)
        {
            cerr << argv[0] << ": NoSuchTopic: " << e.name << endl;
            return EXIT_FAILURE;
        }
    }
    assert(topic);

    //
    // Get a publisher object, create a twoway proxy and then cast to
    // a Single object.
    //
    if(opts.isSet("cycle"))
    {
        Ice::ObjectPrx prx = topic->getPublisher()->ice_twoway();
        vector<SinglePrx> single;
        Ice::EndpointSeq endpoints = prx->ice_getEndpoints();
	for(Ice::EndpointSeq::const_iterator p = endpoints.begin(); p != endpoints.end(); ++p)
	{
            if((*p)->toString().substr(0, 3) != "udp")
            {
                Ice::EndpointSeq e;
                e.push_back(*p);
                single.push_back(SinglePrx::uncheckedCast(prx->ice_endpoints(e)));
            }
	}
        if(single.size() <= 1)
        {
            cerr << argv[0] << ": Not enough endpoints in publisher proxy" << endl;
            return EXIT_FAILURE;
        }
        int which = 0;
        for(int i = 0; i < 1000; ++i)
        {
            single[which]->event(i);
            which = (which + 1) % static_cast<int>(single.size());
        }
    }
    else
    {
        SinglePrx single = SinglePrx::uncheckedCast(topic->getPublisher()->ice_twoway());
        for(int i = 0; i < 1000; ++i)
        {
            single->event(i);
        }
    }

    return EXIT_SUCCESS;
}
开发者ID:bholl,项目名称:zeroc-ice,代码行数:96,代码来源:Publisher.cpp


示例12: a

int ::AprilTagsComp::run(int argc, char* argv[])
{
	QCoreApplication a(argc, argv);  // NON-GUI application


	sigset_t sigs;
	sigemptyset(&sigs);
	sigaddset(&sigs, SIGHUP);
	sigaddset(&sigs, SIGINT);
	sigaddset(&sigs, SIGTERM);
	sigprocmask(SIG_UNBLOCK, &sigs, 0);



	int status=EXIT_SUCCESS;

	RGBDPrx rgbd_proxy;
	RGBDBusPrx rgbdbus_proxy;
	AprilTagsPrx apriltags_proxy;
	CameraPrx camera_proxy;

	string proxy, tmp;
	initialize();


	try
	{
		if (not GenericMonitor::configGetString(communicator(), prefix, "RGBDProxy", proxy, ""))
		{
			cout << "[" << PROGRAM_NAME << "]: Can't read configuration for proxy RGBDProxy\n";
		}
		rgbd_proxy = RGBDPrx::uncheckedCast( communicator()->stringToProxy( proxy ) );
	}
	catch(const Ice::Exception& ex)
	{
		cout << "[" << PROGRAM_NAME << "]: Exception: " << ex;
		return EXIT_FAILURE;
	}
	rInfo("RGBDProxy initialized Ok!");
	mprx["RGBDProxy"] = (::IceProxy::Ice::Object*)(&rgbd_proxy);//Remote server proxy creation example


	try
	{
		if (not GenericMonitor::configGetString(communicator(), prefix, "RGBDBusProxy", proxy, ""))
		{
			cout << "[" << PROGRAM_NAME << "]: Can't read configuration for proxy RGBDBusProxy\n";
		}
		rgbdbus_proxy = RGBDBusPrx::uncheckedCast( communicator()->stringToProxy( proxy ) );
	}
	catch(const Ice::Exception& ex)
	{
		cout << "[" << PROGRAM_NAME << "]: Exception: " << ex;
		return EXIT_FAILURE;
	}
	rInfo("RGBDBusProxy initialized Ok!");
	mprx["RGBDBusProxy"] = (::IceProxy::Ice::Object*)(&rgbdbus_proxy);//Remote server proxy creation example


	try
	{
		if (not GenericMonitor::configGetString(communicator(), prefix, "CameraProxy", proxy, ""))
		{
			cout << "[" << PROGRAM_NAME << "]: Can't read configuration for proxy CameraProxy\n";
		}
		camera_proxy = CameraPrx::uncheckedCast( communicator()->stringToProxy( proxy ) );
	}
	catch(const Ice::Exception& ex)
	{
		cout << "[" << PROGRAM_NAME << "]: Exception: " << ex;
		return EXIT_FAILURE;
	}
	rInfo("CameraProxy initialized Ok!");
	mprx["CameraProxy"] = (::IceProxy::Ice::Object*)(&camera_proxy);//Remote server proxy creation example

	IceStorm::TopicManagerPrx topicManager = IceStorm::TopicManagerPrx::checkedCast(communicator()->propertyToProxy("TopicManager.Proxy"));

	IceStorm::TopicPrx apriltags_topic;
	while (!apriltags_topic)
	{
		try
		{
			apriltags_topic = topicManager->retrieve("AprilTags");
		}
		catch (const IceStorm::NoSuchTopic&)
		{
			try
			{
				apriltags_topic = topicManager->create("AprilTags");
			}
			catch (const IceStorm::TopicExists&){
				// Another client created the topic.
			}
		}
	}
	Ice::ObjectPrx apriltags_pub = apriltags_topic->getPublisher()->ice_oneway();
	AprilTagsPrx apriltags = AprilTagsPrx::uncheckedCast(apriltags_pub);
	mprx["AprilTagsPub"] = (::IceProxy::Ice::Object*)(&apriltags);


//.........这里部分代码省略.........
开发者ID:robocomp,项目名称:robocomp-robolab,代码行数:101,代码来源:main.cpp


示例13: test

void
allTests(const Ice::CommunicatorPtr& communicator)
{
    {
        cout << "Testing Glacier2 stub... " << flush;
        char** argv = 0;
        int argc = 0;
        SessionHelperClient client;
        client.run(argc, argv);
        cout << "ok" << endl;
    }

    {
        cout << "Testing IceStorm stub... " << flush;
        IceStorm::TopicManagerPrx manager =
                    IceStorm::TopicManagerPrx::uncheckedCast(communicator->stringToProxy("test:default -p 12010"));

        IceStorm::QoS qos;
        IceStorm::TopicPrx topic;
        string topicName = "time";

        try
        {
            topic = manager->retrieve(topicName);
            test(false);
        }
        catch(const IceStorm::NoSuchTopic&)
        {
            test(false);
        }
        catch(const Ice::LocalException&)
        {
        }

        Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapterWithEndpoints("subscriber" ,"tcp");
        Ice::ObjectPrx subscriber = adapter->addWithUUID(new ClockI);
        adapter->activate();
        try
        {
            topic->subscribeAndGetPublisher(qos, subscriber);
            test(false);
        }
        catch(const IceStorm::AlreadySubscribed&)
        {
            test(false);
        }
        catch(const IceUtil::NullHandleException&)
        {
        }
        cout << "ok" << endl;
    }

    {
        cout << "Testing IceGrid stub... " << flush;

        Ice::ObjectPrx base = communicator->stringToProxy("test:default -p 12010");
        IceGrid::RegistryPrx registry = IceGrid::RegistryPrx::uncheckedCast(base);
        IceGrid::AdminSessionPrx session;
        IceGrid::AdminPrx admin;
        try
        {
            session = registry->createAdminSession("username", "password");
            test(false);
        }
        catch(const IceGrid::PermissionDeniedException&)
        {
            test(false);
        }
        catch(const Ice::LocalException&)
        {
        }

        try
        {
            admin = session->getAdmin();
            test(false);
        }
        catch(const IceUtil::NullHandleException&)
        {
        }
        cout << "ok" << endl;
    }
}
开发者ID:Jonavin,项目名称:ice,代码行数:83,代码来源:AllTests.cpp


示例14: a

int ::mycomp::run(int argc, char* argv[])
{
#ifdef USE_QTGUI
    QApplication a(argc, argv);  // GUI application
#else
    QCoreApplication a(argc, argv);  // NON-GUI application
#endif
    int status=EXIT_SUCCESS;

    ControllerPrx controller_proxy;
    DifferentialRobotPrx differentialrobot_proxy;
    LaserPrx laser_proxy;

    string proxy, tmp;
    initialize();


    try
    {
        if (not GenericMonitor::configGetString(communicator(), prefix, "ControllerProxy", proxy, ""))
        {
            cout << "[" << PROGRAM_NAME << "]: Can't read configuration for proxy ControllerProxy\n";
        }
        controller_proxy = ControllerPrx::uncheckedCast( communicator()->stringToProxy( proxy ) );
    }
    catch(const Ice::Exception& ex)
    {
        cout << "[" << PROGRAM_NAME << "]: Exception: " << ex;
        return EXIT_FAILURE;
    }
    rInfo("ControllerProxy initialized Ok!");
    mprx["ControllerProxy"] = (::IceProxy::Ice::Object*)(&controller_proxy);//Remote server proxy creation example


    try
    {
        if (not GenericMonitor::configGetString(communicator(), prefix, "DifferentialRobotProxy", proxy, ""))
        {
            cout << "[" << PROGRAM_NAME << "]: Can't read configuration for proxy DifferentialRobotProxy\n";
        }
        differentialrobot_proxy = DifferentialRobotPrx::uncheckedCast( communicator()->stringToProxy( proxy ) );
    }
    catch(const Ice::Exception& ex)
    {
        cout << "[" << PROGRAM_NAME << "]: Exception: " << ex;
        return EXIT_FAILURE;
    }
    rInfo("DifferentialRobotProxy initialized Ok!");
    mprx["DifferentialRobotProxy"] = (::IceProxy::Ice::Object*)(&differentialrobot_proxy);//Remote server proxy creation example


    try
    {
        if (not GenericMonitor::configGetString(communicator(), prefix, "LaserProxy", proxy, ""))
        {
            cout << "[" << PROGRAM_NAME << "]: Can't read configuration for proxy LaserProxy\n";
        }
        laser_proxy = LaserPrx::uncheckedCast( communicator()->stringToProxy( proxy ) );
    }
    catch(const Ice::Exception& ex)
    {
        cout << "[" << PROGRAM_NAME << "]: Exception: " << ex;
        return EXIT_FAILURE;
    }
    rInfo("LaserProxy initialized Ok!");
    mprx["LaserProxy"] = (::IceProxy::Ice::Object*)(&laser_proxy);//Remote server proxy creation example

    IceStorm::TopicManagerPrx topicManager = IceStorm::TopicManagerPrx::checkedCast(communicator()->propertyToProxy("TopicManager.Proxy"));


    SpecificWorker *worker = new SpecificWorker(mprx);
    //Monitor thread
    SpecificMonitor *monitor = new SpecificMonitor(worker,communicator());
    QObject::connect(monitor, SIGNAL(kill()), &a, SLOT(quit()));
    QObject::connect(worker, SIGNAL(kill()), &a, SLOT(quit()));
    monitor->start();

    if ( !monitor->isRunning() )
        return status;

    while (!monitor->ready)
    {
        usleep(10000);
    }

    try
    {
        // Server adapter creation and publication
        if (not GenericMonitor::configGetString(communicator(), prefix, "CommonBehavior.Endpoints", tmp, ""))
        {
            cout << "[" << PROGRAM_NAME << "]: Can't read configuration for proxy CommonBehavior\n";
        }
        Ice::ObjectAdapterPtr adapterCommonBehavior = communicator()->createObjectAdapterWithEndpoints("commonbehavior", tmp);
        CommonBehaviorI *commonbehaviorI = new CommonBehaviorI(monitor );
        adapterCommonBehavior->add(commonbehaviorI, communicator()->stringToIdentity("commonbehavior"));
        adapterCommonBehavior->activate();




//.........这里部分代码省略.........
开发者ID:aricciva,项目名称:PrimerComponente,代码行数:101,代码来源:main.cpp


示例15: a

int ::speech::run(int argc, char* argv[])
{
#ifdef USE_QTGUI
    QApplication a(argc, argv);  // GUI application
#else
    QCoreApplication a(argc, argv);  // NON-GUI application
#endif
    int status=EXIT_SUCCESS;

    SpeechInformPrx speechinform_proxy;

    string proxy, tmp;
    initialize();

    IceStorm::TopicManagerPrx topicManager = IceStorm::TopicManagerPrx::checkedCast(communicator()->propertyToProxy("TopicManager.Proxy"));

    IceStorm::TopicPrx speechinform_topic;
    while (!speechinform_topic)
    {
        try
        {
            speechinform_topic = topicManager->retrieve("SpeechInform");
        }
        catch (const IceStorm::NoSuchTopic&)
        {
            try
            {
                speechinform_topic = topicManager->create("SpeechInform");
            }
            catch (const IceStorm::TopicExists&) {
                // Another client created the topic.
            }
        }
    }
    Ice::ObjectPrx speechinform_pub = speechinform_topic->getPublisher()->ice_oneway();
    SpeechInformPrx speechinform = SpeechInformPrx::uncheckedCast(speechinform_pub);
    mprx["SpeechInformPub"] = (::IceProxy::Ice::Object*)(&speechinform);



    SpecificWorker *worker = new SpecificWorker(mprx);
    //Monitor thread
    SpecificMonitor *monitor = new SpecificMonitor(worker,communicator());
    QObject::connect(monitor, SIGNAL(kill()), &a, SLOT(quit()));
    QObject::connect(worker, SIGNAL(kill()), &a, SLOT(quit()));
    monitor->start();

    if ( !monitor->isRunning() )
        return status;

    while (!monitor->ready)
    {
        usleep(10000);
    }

    try
    {
        // Server adapter creation and publication
        if (not GenericMonitor::configGetString(communicator(), prefix, "CommonBehavior.Endpoints", tmp, ""))
        {
            cout << "[" << PROGRAM_NAME << "]: Can't read configuration for proxy CommonBehavior\n";
        }
        Ice::ObjectAdapterPtr adapterCommonBehavior = communicator()->createObjectAdapterWithEndpoints("commonbehavior", tmp);
        CommonBehaviorI *commonbehaviorI = new CommonBehaviorI(monitor );
        adapterCommonBehavior->add(commonbehaviorI, communicator()->stringToIdentity("commonbehavior"));
        adapterCommonBehavior->activate();







        // Server adapter creation and publication
        if (not GenericMonitor::configGetString(communicator(), prefix, "SpeechSIMDTopic.Endpoints", tmp, ""))
        {
            cout << "[" << PROGRAM_NAME << "]: Can't read configuration for proxy SpeechSIMDProxy";
        }
        Ice::ObjectAdapterPtr SpeechSIMD_adapter = communicator()->createObjectAdapterWithEndpoints("speechsimd", tmp);
        SpeechSIMDPtr speechsimdI_ = new SpeechSIMDI(worker);
        Ice::ObjectPrx speechsimd = SpeechSIMD_adapter->addWithUUID(speechsimdI_)->ice_oneway();
        IceStorm::TopicPrx speechsimd_topic;
        if(!speechsimd_topic) {
            try {
                speechsimd_topic = topicManager->create("SpeechSIMD");
            }
            catch (const IceStorm::TopicExists&) {
                //Another client created the topic
                try {
                    speechsimd_topic = topicManager->retrieve("SpeechSIMD");
                }
                catch(const IceStorm::NoSuchTopic&)
                {
                    //Error. Topic does not exist
                }
            }
            IceStorm::QoS qos;
            speechsimd_topic->subscribeAndGetPublisher(qos, speechsimd);
        }
        SpeechSIMD_adapter->activate();
//.........这里部分代码省略.........
开发者ID:alvarovillena,项目名称:robocomp-SIMD,代码行数:101,代码来源:main.cpp


示例16: catch

int
run(int argc, char* argv[], const CommunicatorPtr& communicator)
{
    IceUtilInternal::Options opts;
    opts.addOpt("", "id", IceUtilInternal::Options::NeedArg);
    opts.addOpt("", "unsub");

    try
    {
        opts.parse(argc, (const char**)argv);
    }
    catch(const IceUtilInternal::BadOptException& e)
    {
        cerr << argv[0] << ": " << e.reason << endl;
        return EXIT_FAILURE;
    }

    PropertiesPtr properties = communicator->getProperties();
    const char* managerProxyProperty = "IceStormAdmin.TopicManager.Default";
    string managerProxy = properties->getProperty(managerProxyProperty);
    if(managerProxy.empty())
    {
        cerr << argv[0] << ": property `" << managerProxyProperty << "' is not set" << endl;
        return EXIT_FAILURE;
    }

    ObjectPrx base = communicator->stringToProxy(managerProxy);
    IceStorm::TopicManagerPrx manager = IceStorm::TopicManagerPrx::checkedCast(base);
    if(!manager)
    {
        cerr << argv[0] << ": `" << managerProxy << "' is not running" << endl;
        return EXIT_FAILURE;
    }

    ObjectAdapterPtr adapter = communicator->createObjectAdapterWithEndpoints("SingleAdapter", "default");

    TopicPrx topic;
    try
    {
        topic = manager->retrieve("single");
    }
    catch(const IceStorm::NoSuchTopic& e)
    {
        cerr << argv[0] << ": NoSuchTopic: " << e.name << endl;
        return EXIT_FAILURE;
    }

    Ice::ObjectPrx prx = adapter->add(new SingleI(), communicator->stringToIdentity(opts.optArg("id")));
    if(opts.isSet("unsub"))
    {
        topic->unsubscribe(prx);
    }
    else
    {
        IceStorm::QoS qos;
        qos["persistent"] = "true";
        topic->subscribeAndGetPublisher(qos, prx);
    }

    return EXIT_SUCCESS;
}
开发者ID:bholl,项目名称:zeroc-ice,代码行数:61,代码来源:Sub.cpp


示例17: catch

int
run(int argc, char* argv[], const CommunicatorPtr& communicator)
{
    IceUtilInternal::Options opts;
    opts.addOpt("", "ordered");
    opts.addOpt("", "twoway");
    opts.addOpt("", "events", IceUtilInternal::Options::NeedArg);

    try
    {
        opts.parse(argc, (const char**)argv);
    }
    catch(const IceUtilInternal::BadOptException& e)
    {
        cerr << argv[0] << ": " << e.reason << endl;
        return EXIT_FAILURE;
    }

    PropertiesPtr properties = communicator->getProperties();
    const char* managerProxyProperty = "IceStormAdmin.TopicManager.Default";
    string managerProxy = properties->getProperty(managerProxyProperty);
    if(managerProxy.empty())
    {
        cerr << argv[0] << ": property `" << managerProxyProperty << "' is not set" << endl;
        return EXIT_FAILURE;
    }

    ObjectPrx base = communicator->stringToProxy(managerProxy);
    IceStorm::TopicManagerPrx manager = IceStorm::TopicManagerPrx::checkedCast(base);
    if(!manager)
    {
        cerr << argv[0] << ": `" << managerProxy << "' is not running" << endl;
        return EXIT_FAILURE;
    }

    ObjectAdapterPtr adapter = communicator->createObjectAdapterWithEndpoints("SingleAdapter", "default");

    TopicPrx topic;
    while(true)
    {
        try
        {
            topic = manager->retrieve("single");
            break;
        }
        // This can happen if the replica group loses the majority
        // during retrieve. In this case we retry.
        catch(const Ice::UnknownException&)
        {
            continue;
        }
        catch(const IceStorm::NoSuchTopic& e)
        {
            cerr << argv[0] << ": NoSuchTopic: " << e.name << endl;
            return EXIT_FAILURE;
        }
    }

    int events = 1000;
    if(opts.isSet("events"))
    {
        events = atoi(opts.optArg("events").c_str());
    }
    //
    // Create subscribers with different QoS.
    //
    SingleIPtr sub;
    IceStorm::QoS qos;
    if(opts.isSet("ordered"))
    {
        sub = new SingleI(communicator, "twoway ordered", events);
        qos["reliability"] = "ordered";
    }
    else
    {
        sub = new SingleI(communicator, "twoway", events);
    }

    Ice::ObjectPrx prx = adapter->addWithUUID(sub);

    while(true)
    {
        try
        {
            topic->subscribeAndGetPublisher(qos, prx);
            break;
        }
        // If we're already subscribed then we're done (previously we
        // got an UnknownException which succeeded).
        catch(const IceStorm::AlreadySubscribed&)
        {
            break;
        }
        // This can happen if the replica group loses the majority
        // during subscription. In this case we retry.
        catch(const Ice::UnknownException&)
        {
        }
    }

//.........这里部分代码省略.........
开发者ID:2008hatake,项目名称:zeroc-ice,代码行数:101,代码来源:Subscriber.cpp


示例18: run

int inversekinematicsAgentComp::run(int argc, char* argv[])
{
#ifdef USE_QTGUI
	QApplication a(argc, argv);  // GUI application
#else
	QCoreApplication a(argc, argv);  // NON-GUI application
#endif
	int status=EXIT_SUCCESS;

	// Remote server proxy access example
	// RemoteComponentPrx remotecomponent_proxy;
	BodyInverseKinematicsPrx bodyinversekinematics_proxy;
AGMAgentTopicPrx agmagenttopic_proxy;


	string proxy;

	// User variables


	initialize();

	// Remote server proxy creation example
	// try
	// {
	// 	// Load the remote server proxy
	//	proxy = getProxyString("RemoteProxy");
	//	remotecomponent_proxy = RemotePrx::uncheckedCast( communicator()->stringToProxy( proxy ) );
	//	if( !remotecomponent_proxy )
	//	{
	//		rInfo(QString("Error loading proxy!"));
	//		return EXIT_FAILURE;
	//	}
	//catch(const Ice::Exception& ex)
	//{
	//	cout << "[" << PROGRAM_NAME << "]: Exception: " << ex << endl;
	//	return EXIT_FAILURE;
	//}
	//rInfo("RemoteProxy initialized Ok!");
	// 	// Now you can use remote server proxy (remotecomponent_proxy) as local object
	//Remote server proxy creation example
	try
	{
		bodyinversekinematics_proxy = BodyInverseKinematicsPrx::uncheckedCast( communicator()->stringToProxy( getProxyString("BodyInverseKinematicsProxy") ) );
	}
	catch(const Ice::Exception& ex)
	{
		cout << "[" << PROGRAM_NAME << "]: Exception: " << ex;
		return EXIT_FAILURE;
	}
	rInfo("BodyInverseKinematicsProxy initialized Ok!");
	mprx["BodyInverseKinematicsProxy"] = (::IceProxy::Ice::Object*)(&bodyinversekinematics_proxy);
	IceStorm::TopicManagerPrx topicManager = IceStorm::TopicManagerPrx::checkedCast(communicator()->propertyToProxy("TopicManager.Proxy"));
	
	IceStorm::TopicPrx agmagenttopic_topic;
    while(!agmagenttopic_topic){
		try {
			agmagenttopic_topic = topicManager->retrieve("AGMAgentTopic");
		}catch (const IceStorm::NoSuchTopic&){
			try{
				agmagenttopic_topic = topicManager->create("AGMAgentTopic");
			}catch (const IceStorm::TopicExists&){
				// Another client created the topic.
			}
		}
	}
	Ice::ObjectPrx agmagenttopic_pub = agmagenttopic_topic-& 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ iceutil::ThreadPtr类代码示例发布时间:2022-05-31
下一篇:
C++ iceinternal::ProxyHandle类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap