All the C++ API that begins with either "DDS_" or "DDS" can be replaced with its namespace equivalent. For example, DDSDomainParticipant has a namespace equivalent of DDS::DomainParticipant, and DDS_DomainParticipantQos has a namespace equivalent of DDS::DomainParticipantQos.
In order to use the DDS namespace, an additional header file, ndds_namespace_cpp.h , will need to be included in your source file:
#include "ndds/ndds_cpp.h" #include "ndds/ndds_namespace_cpp.h" DDS::DomainParticipant *participant = NULL; DDS::DomainParticipantQos participant_qos; DDS::DomainParticipantListener *listener = NULL; DDS::StatusKind status_kind = DDS::INCONSISTENT_TOPIC_STATUS; DDS::Long counter = 0L;
If the namespace header file is not included in the source file, DDS namespace cannot be used in the RTI Data Distribution Service API.
#include "ndds/ndds_cpp.h" #include "ndds/ndds_namespace_cpp.h" using namespace DDS; Long ddsCounter = 0L; long nativeCounter = 0L;
If you want to exclude the DDS namespace support for primitive types, you can define NDDS_EXCLUDE_PRIMITIVE_TYPES_FROM_NAMESPACE in you application before including the namespace header file. DDS namespace support for primitive types will then be excluded:
#include "ndds/ndds_cpp.h" #define NDDS_EXCLUDE_PRIMITIVE_TYPES_FROM_NAMESPACE #include "ndds/ndds_namespace_cpp.h" using namespace DDS; DDS_Long ddsCounter = 0; long nativeCounter = 0;
For the rest of the documentation, the DDS prefix is used for all class /types/constants names. However, all the API with the DDS prefix can be replaced with DDS namespace instead if the namespace header file is included.