C++ language considerations
This collection of topics details the aspects of the C++ language usage and conventions that you must consider when writing application programs that use the Message Queue Interface (MQI).
C++ Header files
Header files are provided as part of the definition of the MQI, to help you write IBM MQ application programs in the C++ language.
C++ methods and attributes
Method names are in mixed case. Various considerations apply to parameters and return values. Attributes are accessed using set and get methods as appropriate.
Data types in C++
All data types are defined by the C typedef statement.
Manipulating binary strings in C++
Strings of binary data are declared as objects of the ImqBinary class. Objects of this class can be copied, compared, and set using the familiar C operators. Example code is provided.
Manipulating character strings in C++
Character data is often returned in ImqString class objects which can be cast to char * using a conversion operator. The ImqString class contains methods to assist in the processing of character strings.
Initial state of objects in C++
All objects have a consistent initial state reflected by their attributes. The initial values are defined in the class descriptions.
Use C from C++
When we use C functions from a C++ program, include appropriate headers.
C++ notational conventions
This example shows how to invoke methods and declare parameters.
Implicit operations in C++
Several operations can occur implicitly, just in time , to satisfy the prerequisite conditions for the successful execution of a method. These implicit operations are connect, open, reopen, close, and disconnect. We can control connect and open implicit behavior using class attributes.
Binary and character strings in C++
The ImqString class encapsulates the traditional char * data format. The ImqBinary class encapsulates the binary byte array. Some methods that set character data might truncate the data.
Unsupported functions in C++
The IBM MQ C++ classes and methods are independent of IBM MQ platform. They might therefore offer some functions that are not supported on certain platforms.
Parent topic: Developing C++ applications