Can Two CORBA Interfaces Be Implemented in One UNIX Process?



Implement Two CORBA Interfaces in One UNIX Process

January 31, 2004

Problem Description:
I work with a small team of software developers that are new to building CORBA interfaces. In the last few months we have learned how to use ORBit2 and the C++ binding to build interfaces where the client and server for each interface are UNIX processes.
Now we have an architectural problem where we would like to build a single process that implements two different CORBA interfaces. We would like the server of one interface to run in a thread and the client of the other interface to run in a different thread. Our problem is complicated by the fact that the two different CORBA interfaces share common data types. The diagram below represents our basic hardware and software architecture.



Simple IDL Example:
Although our interfaces are more complicated, I have included a simplified example that demonstrates the problem we have compiling the IDL files and linking the UNIX process. There are three IDL files, two define the interfaces (ClientInterface.idl and ServerInterface.idl) and the other file contains the common types that the two interfaces share (Types.idl).
 

When the two interfaces are compiled with the following commands the ClientInterface-cpp-common.h and the ServerInterface-cpp-common.h files both pull the shared types into the files.
orbit-idl-2 -I. ClientInterface.idl
orbit-idl-2 --skeleton-impl --lang="cpp" -I. ClientInterface.idl
orbit-idl-2 -I. ServerInterface.idl
orbit-idl-2 --skeleton-impl --lang="cpp" -I. ServerInterface.idl

When the process that contains the server thread and the client thread include the .h files for both interfaces, I get a compilation error for redefining the same types:

gcc -c -g -DORBIT2=1 -D_REENTRANT -I/usr/local/include/orbit-2.0 -I/usr/local/include/linc-1.0 -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include -I/usr/local/include/orbitcpp-2.0 -I/usr/local/include/orbit-2.0/ORBitservices ClientServerProc.cc
In file included from ClientServerProc.cc:16:
ServerInterface-cpp-common.h:26: error: redefinition of `struct NLCA::myType'
ClientInterface-cpp-common.h:26: error: previous definition of `struct 
   NLCA::myType'

I looked at the command line flags that are defined for orbit-idl-2 --help and tried to see if there was a combination of settings that stops the C++ binding from including the shared type in the <interface name>-cpp-common.h files, but I could not find a solution.

Questions:
1.	Is it possible to implement the architecture above with the ORBit2’s C++ binding?
2.	Is there documentation on the command-line flags defined for orbit-idl-2 other than the output from the --help flag?
3.	Are there any examples that show how someone has solved a similar problem with ORBit2?

Thanks,
Larry

Attachment: idl.tar.gz
Description: application/gzip-compressed



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]