コード例 #1
0
void RTPSAsSocketReader::Listener::onNewCacheChangeAdded(RTPSReader* reader, const CacheChange_t* const change)
{

	ReaderHistory *history = reader->getHistory();

    history->remove_change((CacheChange_t*)change);

    uint16_t number;
    std::istringstream input((char*)change->serializedPayload.data);
    std::string word;
    input >> word;

    if(word.compare(reader_.word_) == 0)
    {
        input >> number;
        reader_.newNumber(number);
    }
コード例 #2
0
void RTPSAsSocketReader::Listener::onNewCacheChangeAdded(RTPSReader* reader, const CacheChange_t* const change)
{
    ASSERT_NE(reader, nullptr);
    ASSERT_NE(change, nullptr);

	ReaderHistory *history = reader->getHistory();
    ASSERT_NE(history, nullptr);

    history->remove_change((CacheChange_t*)change);

    uint16_t number;
#ifdef WIN32
    ASSERT_EQ(sscanf_s((char*)change->serializedPayload.data, "My example string %hu", &number), 1);
#else
    ASSERT_EQ(sscanf((char*)change->serializedPayload.data, "My example string %hu", &number), 1);
#endif
    reader_.newNumber(number);
}