setting dynamicdata member after empty sequence member

2 posts / 0 new
Last post
Offline
Last seen: 6 years 9 months ago
Joined: 04/04/2014
Posts: 27
setting dynamicdata member after empty sequence member

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:

  1. Empty sequence to double_seq
  2. double_val
  3. ulong_val

But it fails to set member values in the order:

  1. Empty sequence to double_seq
  2. ulong_val
  3. double_val

It's also possible to set member values in the order:

  1. double_val
  2. Empty sequence to double_seq
  3. 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!

AttachmentSize
File minimal.cpp4.38 KB
Organization:
Offline
Last seen: 6 years 9 months ago
Joined: 04/04/2014
Posts: 27

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 of DDS_DynamicData_set_XXX methods causing the described problem.

DDS_DynamicDataStream_zero_uptoI is locally linked in the  nddsc library and must be compiled from the source code to be used.