本文整理汇总了C++中OTData::get方法的典型用法代码示例。如果您正苦于以下问题:C++ OTData::get方法的具体用法?C++ OTData::get怎么用?C++ OTData::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OTData
的用法示例。
在下文中一共展示了OTData::get方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
TEST_F(Test_RouterDealer, Dealer_3_Router_Dealer_Router)
{
ASSERT_NE(nullptr, &Test_RouterDealer::context_.get());
auto dealerCallback =
zmq::ListenCallback::Factory([this](zeromq::Message& input) -> void {
EXPECT_EQ(3, input.size());
const std::string& inputString = *input.Body().begin();
bool match = inputString == testMessage_ ||
inputString == testMessage2_ ||
inputString == testMessage3_;
EXPECT_TRUE(match);
auto sent = routerSocket_->get().Send(input);
EXPECT_TRUE(sent);
++callbackFinishedCount_;
});
ASSERT_NE(nullptr, &dealerCallback.get());
auto dealerSocket = zmq::DealerSocket::Factory(
Test_RouterDealer::context_,
zmq::Socket::Direction::Bind,
dealerCallback);
ASSERT_NE(nullptr, &dealerSocket.get());
ASSERT_EQ(SocketType::Dealer, dealerSocket->Type());
dealerSocket->SetTimeouts(
std::chrono::milliseconds(0),
std::chrono::milliseconds(30000),
std::chrono::milliseconds(-1));
dealerSocket->Start(dealerEndpoint_);
dealerSocket_ = &dealerSocket;
auto routerCallback =
zmq::ListenCallback::Factory([this](zeromq::Message& input) -> void {
EXPECT_EQ(3, input.size());
const std::string& inputString = *input.Body().begin();
bool match = inputString == testMessage_ ||
inputString == testMessage2_ ||
inputString == testMessage3_;
EXPECT_TRUE(match);
auto sent = dealerSocket_->get().Send(input);
EXPECT_TRUE(sent);
++callbackFinishedCount_;
});
ASSERT_NE(nullptr, &routerCallback.get());
auto routerSocket = zmq::RouterSocket::Factory(
Test_RouterDealer::context_,
zmq::Socket::Direction::Bind,
routerCallback);
ASSERT_NE(nullptr, &routerSocket.get());
ASSERT_EQ(SocketType::Router, routerSocket->Type());
routerSocket->SetTimeouts(
std::chrono::milliseconds(0),
std::chrono::milliseconds(-1),
std::chrono::milliseconds(30000));
routerSocket->Start(routerEndpoint_);
routerSocket_ = &routerSocket;
std::vector<OTZMQMessage> replyMessages;
auto clientRouterCallback = zmq::ListenCallback::Factory(
[this, &replyMessages](const network::zeromq::Message& input) -> void {
const std::string& inputString = *input.Body().begin();
bool match = inputString == testMessage_ ||
inputString == testMessage2_ ||
inputString == testMessage3_;
EXPECT_TRUE(match);
auto replyMessage = zeromq::Message::Factory();
for (auto it = input.begin(); it != input.end(); ++it) {
auto& frame = *it;
if (0 < frame.size()) {
OTData data = Data::Factory(frame.data(), frame.size());
replyMessage->AddFrame(data.get());
} else {
replyMessage->AddFrame();
}
}
replyMessages.push_back(replyMessage);
++callbackFinishedCount_;
});
//.........这里部分代码省略.........