The SmartSockets C++ class library organizes the C language API into an object-oriented C++ class library. Therefore, if you are already working in C++ and with object-oriented software in general, you reap the greatest benefits in using the SmartSockets C++ class library. Because the SmartSockets C++ class library adds no additional IPC capabilities beyond what is already present in the SmartSockets C language API, the choice whether to use the SmartSockets C++ class library or the C language API is essentially up to you.
Some of the key advantages of the SmartSockets C++ class library are:
By grouping together related methods into a particular C++ class, the SmartSockets C++ class library reduces the name length and the numbers of arguments of many of the corresponding C API functions, leading to shorter, more readable code.
In C++, the allocation, initialization, and deallocation of objects is often localized to class constructors and destructors. Where possible, the classes included in the SmartSockets C++ class library use this technique to assume responsibility for the memory allocation and destruction of SmartSockets system objects on your behalf. You are then freed from having to explicitly allocate objects using functions such as TipcMsgCreate, and from having to explicitly deallocate objects using functions such as TipcMsgDestroy.
Several of the provided C++ classes in the SmartSockets C++ class library are available to you for reuse through inheritance and re-implementation of their virtual member functions. Also, you may syntactically associate callback functions with SmartSockets C++ classes by deriving your own classes from SmartSockets C++ classes, such as TipcConnClient. Using this technique syntactically groups the callback functionality of a network connection with the connection itself, inside a particular C++ class, making the resulting code more suitable for extension, reuse, and modification.
The SmartSockets TipcMsg class, described in the later chapters of this guide, describes how C++ insertion and extraction operator overloading is used in the TipcMsg class to unify much of the process of constructing, reading, and writing the messages inside a SmartSockets application program.
TIBCO SmartSockets™ cxxipc Class Library Software Release 6.8, July 2006 Copyright © TIBCO Software Inc. All rights reserved www.tibco.com |