Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved


Appendix A SDK Programming Guidelines : C++ Utility Classes and Methods

C++ Utility Classes and Methods
A number of utilities classes and methods are available for building a custom adapter.
MList, MMap, MString, and MWString
 
The C++ SDK includes some templated utility classes that make SDK-based adapters portable across platforms. Custom adapters can use the following classes:
MString—Templated string functionality.
MWString—Templated string functionality for unicode (M_UTF16BE) strings.
MMap—Templated map functionality.
MList—Templated list functionality.
Custom adapters can use the SDK classes in conjunction with the C++ Standard Template Library (STL). However, SDK methods only use the SDK classes.
The downCast() Method
A number of SDK methods have as their return value type a class that is a superclass of the direct parent class of an object. For example, certain methods return pointers to MComponent, where the component returned is an instance of a subclass of MComponent. The downCast() method allows applications to safely cast the return value to the appropriate subclass so that the subclass methods can then be called.
Custom adapters usually use the downCast() method as in the following example:
MPublisher* pPublisher = MPublisher::downCast (pComp);
if (pPublisher)...
//can call MPublisher methods now...
Instead of throwing an exception, NULL is returned when the cast operation fails.
SDK Enumerators
 
The C++ SDK offers enumerator classes for a number of its classes. Table 44 lists available C++ enumerators that are included in the API reference.
Iterates through MProperties instances.
MListEnumerator, MMapEnumerator
Iterates through MList and MMap instances.
 
SDK Types
The C++ SDK supports the type Mboolean, which is implemented as a #define. Its value can be either Mtrue or Mfalse. The type provides cross-platform boolean support.

Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved