Hi, everyone
I have a idl defined like this:
struct StdEntity
{
boolean valid; //@Optional
char id[20];
long type[100]; //@Optional
double val[1500];
};
the member valid and val does not transfer every time, so i want known that how to set and get value for these optional members.
thanks for any help
My program is developed using C++ language, and dds version 5.2.3.
Are you using Modern C++ (aka C++03/C++11) or the Traditional C++ API (aka C++98)?
If using the Traditional C++ API, the IDL definition fundamentally maps into a class with publically accessible members of the type described in the IDL. @optional members are mapped to pointers of the same type
e.g.
long type[100]; //@optional
is mapped to
long *type[100];
set the pointer to NULL to not send data for the array. When received, you test to see if the pointer is NULL, if so, then it wasn't sent. You can just check the header file that defines the data type for this.
If using Modern C++, then the type gets encasulated into a dds::optional object. See the documentation here:
https://community.rti.com/static/documentation/connext-dds/5.2.3/doc/api/connext_dds/api_cpp2/classdds_1_1core_1_1optional.html
thanks, i got it,its turely a pointer.