本文整理汇总了C++中HelloWorld::message方法的典型用法代码示例。如果您正苦于以下问题:C++ HelloWorld::message方法的具体用法?C++ HelloWorld::message怎么用?C++ HelloWorld::message使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HelloWorld
的用法示例。
在下文中一共展示了HelloWorld::message方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: newNumber
void ReqRepHelloWorldReplier::newNumber(SampleIdentity sample_identity, uint16_t number)
{
waitDiscovery();
WriteParams wparams;
HelloWorld hello;
hello.index(number);
hello.message("GoodBye");
wparams.related_sample_identity(sample_identity);
ASSERT_EQ(reply_publisher_->write((void*)&hello, wparams), true);
}
示例2: send
void PubSubKeepAllTransientWriter::send(const std::list<uint16_t> &msgs)
{
waitDiscovery();
for(std::list<uint16_t>::const_iterator it = msgs.begin(); it != msgs.end(); ++it)
{
HelloWorld hello;
hello.index(*it);
hello.message("HelloWorld");
publisher_->write((void*)&hello);
}
}
示例3: main
int main()
{
ParticipantAttributes participant_attributes;
Participant* participant = Domain::createParticipant(participant_attributes);
if(participant == nullptr)
return 1;
HelloWorldType type;
Domain::registerType(participant,&type);
PubListener listener;
//CREATE THE PUBLISHER
PublisherAttributes publisher_attributes;
publisher_attributes.topic.topicKind = NO_KEY;
publisher_attributes.topic.topicDataType = type.getName();
publisher_attributes.topic.topicName = "HelloWorldTopic";
publisher_attributes.qos.m_reliability.kind = RELIABLE_RELIABILITY_QOS;
Publisher* publisher = Domain::createPublisher(participant, publisher_attributes, &listener);
if(publisher == nullptr)
{
Domain::removeParticipant(participant);
return 1;
}
while(listener.matched_ == 0)
eClock::my_sleep(250);
HelloWorld data;
data.index(1);
data.message("HelloWorld");
while(1)
{
publisher->write((void*)&data);
if(data.index() == 4)
data.index() = 1;
else
++data.index();
eClock::my_sleep(250);
};
Domain::removeParticipant(participant);
return 0;
}
示例4: send
void ReqRepHelloWorldRequester::send(const uint16_t number)
{
waitDiscovery();
WriteParams wparams;
HelloWorld hello;
hello.index(number);
hello.message("HelloWorld");
std::unique_lock<std::mutex> lock(mutex_);
ASSERT_EQ(request_publisher_->write((void*)&hello, wparams), true);
related_sample_identity_ = wparams.sample_identity();
current_number_ = number;
}
示例5:
void ReqRepHelloWorldRequester::ReplyListener::onNewDataMessage(Subscriber *sub)
{
ASSERT_NE(sub, nullptr);
HelloWorld hello;
SampleInfo_t info;
if(sub->takeNextData((void*)&hello, &info))
{
if(info.sampleKind == ALIVE)
{
ASSERT_EQ(hello.message().compare("GoodBye"), 0);
requester_.newNumber(info.related_sample_identity, hello.index());
}
}
}
示例6: expected
void HelloWorldTest::test0()
{
HelloWorld hello;
string expected("Hello World");
CPPUNIT_ASSERT_EQUAL(expected, hello.message());
}
示例7: expected
TEST(HelloWorldTest, test0)
{
HelloWorld hello;
string expected("Hello World");
ASSERT_EQ(expected, hello.message());
}