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);
	}
}
Exemplo n.º 2
0
void PubSubData64kbWriter::send(const std::list<uint16_t> &msgs)
{
    waitDiscovery();

    Data64kb data;
    for(int i = 0; i < 63996; ++i)
        data.data().push_back((unsigned char)i);

	for(std::list<uint16_t>::const_iterator it = msgs.begin(); it != msgs.end(); ++it)
	{
        data.data()[0] = (unsigned char)*it;
        ASSERT_EQ(publisher_->write((void*)&data), true);
	}
}
Exemplo n.º 3
0
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;
}
void RTPSWithRegistrationWriter::send(const std::list<uint16_t> &msgs)
{
    waitDiscovery();

	for(std::list<uint16_t>::const_iterator it = msgs.begin(); it != msgs.end(); ++it)
	{
		CacheChange_t * ch = writer_->new_change(ALIVE);

#if defined(_WIN32)
        ch->serializedPayload.length =
            (uint16_t)sprintf_s((char*)ch->serializedPayload.data, 255, "My example string %hu", *it) + 1;
#else
		ch->serializedPayload.length =
			sprintf((char*)ch->serializedPayload.data,"My example string %hu", *it) + 1;
#endif

		history_->add_change(ch);
	}
}