RTI Connext Traditional C++ API  Version 5.2.3
 All Classes Functions Variables Typedefs Enumerations Enumerator Groups Pages
Using DDS:: Namespace

This section describes the C++ namespace support in the DDS API.

DDS Namespace Support

In this documentation, all C++ classes, value types, interface types and constants have names beginning with either "DDS_" or "DDS". Alternatively, DDS namespace can also be used to refer to all these classes, types or constant.

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::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 Connext API.

DDS Namespace and Primitive Types

By default, DDS namespace support for primitive types are included. With DDS namespace support, the difference between DDS types and native types can just be the capitalization in some cases:

#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.


RTI Connext Traditional C++ API Version 5.2.3 Copyright © Wed Apr 27 2016 Real-Time Innovations, Inc