How to write/read sequence type PreviousNext
Data Distribution Service (DDS) Forum > DDS Technical Forum >
Message/Author
Next message Georgi Ivanov Ivanov  posted on Tuesday, June 22, 2010 - 08:37 pm
Hi,

I use the SIMD library. I try to write/read unbounded sequence. For example my idl structure is:

module ZZ_EXCHANGE {

struct PP_Message{
long ID_kk;
long time;
long act;
long ID_temp;
sequence<long> unbounded_sec;
};
#pragma keylist PP_Message ID_kk

};

I use the next lines of code to write data:

ZZ_EXCHANGE::PP_Message kk_info;

info.ID_kk = 2;
info.time = 11;
info.act = 4;
info.ID_temp = 5

info.unbounded_sec.length(3);

for (long cnt = 0; cnt < info.unbounded_sec.length(); ++cnt)
{ info.unbounded_sec[cnt] = 10;
}

writer_->write(info, DDS::HANDLE_NIL);





The subscribing part of the application is (listener):

handle_data(dds::DataReader<zz_exchange::pp_message> reader)
{
dds::topic_data_seq<zz_exchange::pp_message>::type samples;
DDS::SampleInfoSeq infos;

ZZ_EXCHANGE::PP_Message info;
reader.read(samples, infos);

DDS::ULong number;
for (int i = 0; i < samples.length(); ++i)
{
info.ID_kk = samples[i].ID_kk;
info.act = samples[i].act;
info.ID_temp = samples[i].ID_temp;
info.time = samples[i].time;
info.unbounded_sec = samples[i].unbounded_sec;
}
reader.return_loan(samples, infos);
}


The received values for ID_kk, act, ID_temp and time are OK. But the value for unbounded sequence unbounded_sec is not correct.

Could you tell me how to resolve the problem?

Goerge

Thank you in advance!
Back to top
Add Your Message Here
Post:
Username: Posting Information:
This is a private posting area. Only registered users and moderators may post messages here.
Password:
Options: Post as "Anonymous"
Enable HTML code in message
Automatically activate URLs in message
Action: