Table of Contents
As of Tweek version 0.13.0, users can write C++ clients in
addition to Java and Python clients. As of this writing, the interface
is relatively low-level. The C++ counterpart of the Java class
org.vrjuggler.tweek.net.corba.CorbaService is used to communicate with a remote C++ server. The
class is tweek::CorbaService, and its API is almost identical to the Java version. The
basic idea is that users familiar with the Java API can easily make use
of the C++ version and vice versa.
In this chapter, we explain how to write C++ clients. First, we cover the CORBA Service, and then we show how to use it with a C++ client application. The basic ideas are identical to those used in Java clients. The syntax varies slightly due to the differences in the C++ and Java mappings of IDL. Additionally, we do not need to be concerned with JavaBeans because we will be speaking strictly in terms of C++. There is nothing to prevent an ambitious user from developing a C++ counterpart to the Tweek Java GUI, however.
The CORBA Service, implemented in the class
tweek::CorbaService, simplifies the use of CORBA for C++ clients. Instances
are constructed by providing the host name and port where the CORBA
Naming Service is listening for incoming requests. Once constructed,
the CORBA Service must be initialized. This creates the local root
POA, acquires a reference to the Naming Service, and starts the local
ORB thread. At this point, the CORBA Service can be used exactly as it
would be used in Java (see Chapter 6, Putting It All Together). For
example, the remote Subject Manager reference can be requested and
servants (C++ implementations of
tweek::Observer) can be
registered.