本文整理汇总了C++中TopicPrx::getNonReplicatedPublisher方法的典型用法代码示例。如果您正苦于以下问题:C++ TopicPrx::getNonReplicatedPublisher方法的具体用法?C++ TopicPrx::getNonReplicatedPublisher怎么用?C++ TopicPrx::getNonReplicatedPublisher使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TopicPrx
的用法示例。
在下文中一共展示了TopicPrx::getNonReplicatedPublisher方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}