The C++ class library organizes the various flavors of SmartSockets connections into several C++ classes (see Figure 4). The base class TipcConn declares and defines virtual member functions used by the derived user classes TipcConnServer and TipcConnClient. A final class derived from the TipcConnClient, called TipcSrv, which encapsulates the RTclient functionality, is described in Chapter 5, Publish and Subscribe.
The TipcConn class contains a C type T_IPC_CONN and a collection of member functions that wrap the TipcConn* functions from the C API. Many of the member functions are declared as virtual member functions so that derived classes have the ability to reimplement their behavior. In fact, the TipcSrv class reimplements many of the TipcConn virtual member functions using TipcSrv* functions from the C API.
The proper constructor for a connection is selected depending on whether the process is acting as a server or a client.
Server connections listen for connections from clients. They are created using the TipcConnServer class. Any of the supported protocols may be used with this class, which calls the C API function TipcConnCreateServer.
The TipcConnClient class is used to create a connection that is hooked to the paired server connection. This class calls the C API function TipcConnCreateClient to make the connection and connect it to the corresponding server connection.
The TipcConn class is used in instances where a dummy connection is desired. The member functions of the TipcConn class are capable of processing internally generated messages. This class creates a dummy connection by calling the C API function TipcConnCreate.
TIBCO SmartSockets™ cxxipc Class Library Software Release 6.8, July 2006 Copyright © TIBCO Software Inc. All rights reserved www.tibco.com |