Sequence problem

5 posts / 0 new
Last post
Offline
Last seen: 5 years 10 months ago
Joined: 12/20/2018
Posts: 3
Sequence problem

Problem in assigning a value in sequence

 In idl file containing

Struct B

{

Long id;

sequence <long , 5 > values;

sequence <long , 5 > value2;

}

Struct A

{

Long key;

B  Emp;

}

 

Instance->key =1;

Instance->Emp.id =2;

Both this is correct but when assigning in sequence 

Instance->Emp.value =1; this is causing problem 

It is saying = invalid conversion from int to DDS_LongSeq

Help me 

Keywords:
Offline
Last seen: 10 months 2 weeks ago
Joined: 02/11/2016
Posts: 144

Hey,

"sequence <long , 5 > values" in the idl translates into a LongSeq in what I'm guessing is C++.
When instance is instantiated I believe all of its sequences are created "empty".
I think (haven't used c++ with rti so not certain) Instance->Emp.value.add(1) (or set(0, 1) may work.

Good luck,
Roy.

Offline
Last seen: 5 years 10 months ago
Joined: 12/20/2018
Posts: 3

I tried it, but not working saying doesnt recognized add()

Offline
Last seen: 10 months 2 weeks ago
Joined: 02/11/2016
Posts: 144

Please check out the documentation: http://community.rti.com/rti-doc/510/ndds/doc/html/api_cpp/structFooSeq.html

you can access sequences like an array (with []) or use the from_array method.

 

good luck.

Offline
Last seen: 5 years 10 months ago
Joined: 12/20/2018
Posts: 3

I tried lot of things but still not happening. If anyone can share any example related to this it would be really helpful.