Hey,
I'm currently using DDS_DynamicData to map my application's type to DDS_DynamicData. However, my application also uses Arrays of strings, which I've mapped over Sequences of Strings in DDS_DynamicData. I've just stumbled upon the problem that I cannot call "DDS_DynamicData::set_string_seq" on a DDS_DynamicData object.
I already know that I can bind to the sequence and set each sequence member sepparately, but I cannot do this in my application because the data that needs to be mapped to DDS_DynamicData comes as a contiguous buffer.
For example, I'm using a sequence of DDS_TK_CHAR in order to map strings, and then I'm doing the following on it:
DDS_CharSeq charSeq;
charSeq.ensure_length(stringLength, stringLength);
std::memcpy(charSeq.get_contiguous_buffer(), stringData, stringLength);
retCode = sendData->set_char_seq(memberName, DDS_DYNAMIC_DATA_MEMBER_ID_UNSPECIFIED, charSeq);
This is something I want to do for strings as well:
DDS_StringSeq stringSeq;
stringSeq.ensureLength(stringArrayLength, stringArrayLength);
std::memcpy(stringSeq.get_contiguous_buffer(), stringArrayData, stringArrayLength);
retcode = sendData->set_string_Seq(memberName, DDS_DYNAMIC_DATA_MEMBER_ID_UNSPECIFIED, stringSeq);
Can someone tell me if there's a way to set a sequence of strings this way?
Thank you.
Best,
Andrei
Hi Andrey,
Because strings are complex types, there is no API to set a sequence of Strings with one call like you do with the sequence of characters.
I think the only solution is bind and set member by member. You mentioned that is impossible in your case, why is that the case?
Thanks,
Fernando.
Hey Fernando,
My string array comes as a byte array. However, I think I can get the length of each array element size and set the string element by binding and setting each member by member. I've postponed this fix for now but I expect I will get back to it in some time.
Thank you for the answer :)
Best,
Andrei