Hello,
this question is probably related to my another question Delete last element of DynamicData sequence member but I think it's another problem.
I'm creating following type dynamically and try to set values to the members.
struct test_type { double double_val_first; //@ID 0 sequence<double,20> double_seq; //@ID 1 boolean bool_1; //@ID 2 unsigned long ulong_val; //@ID 3 double double_val; //@ID 4 double double_val_second; //@ID 5 unsigned long long ulonglong_val; //@ID 6 }; //@Extensibility EXTENSIBLE_EXTENSIBILITY
It's possible to set member values in the order:
- Empty sequence to double_seq
- double_val
- ulong_val
But it fails to set member values in the order:
- Empty sequence to double_seq
- ulong_val
- double_val
It's also possible to set member values in the order:
- double_val
- Empty sequence to double_seq
- ulong_val
It's complicated to formulate but it looks so:
- If the first set-call sets some primitive member then everything works fine
- If the first set-calls were only for empty sequences, a set-call for primitive member after the empty sequence fails
- If the first set-calls were only for empty sequences, a set-call for any primitive member after the member after the empty sequence fixes the situation
I suppose the set-calls perform some initialization on the new data but I didn't manage to find out what exactly should be done to the dynamic data object after creation to avoid this problem. Any ideas how to fill dynamic data in any order without first having to call set method for some primitive member?
I've attached a minimal example, it's output is:
Thank you!
Attachment | Size |
---|---|
minimal.cpp | 4.38 KB |
This problem can be solved by calling
DDS_DynamicDataStream_zero_uptoI
on the newly created DynamicData (actually on DDS_DynamicDataStream initialized with DynamicData). Nevertheless I suppose that there could be some problem in the logic ofDDS_DynamicData_set_XXX
methods causing the described problem.DDS_DynamicDataStream_zero_uptoI
is locally linked in thenddsc
library and must be compiled from the source code to be used.