![]() |
The Java Language to IDL specification maps Java serializables to CORBA value types. Therefore every Java serializable to be passed by a CORBA client as a parameter or return value for an Enterprise JavaBean must be re-implemented in the language of the client. Implementation of Java serializables as value types in C++ or another language can be a significant development effort.
To aid application development, WebSphere Application Server provides a valuetype library that contains C++ valuetype implementations for some commonly used Java classes in the java.lang, java.io, java.util, and javax.ejb packages. For example, Integer, Float, Vector, Exception, OutputStream, and so on. The valuetype library supports the WebSphere C++ ORB.
These classes represent an established hierarchy in the Java language and are implemented to preserve the inheritance relationship that exists in certain Java packages. These classes enable CORBA programmers to use the WebSphere C++ classes in the same way they would use their Java counterparts. Constructors in the original Java classes do not need to be mapped to the IDL definitions and the C++ bindings; when mapped, constructors become init methods on the factory classes.
The IDL compiler always provides a pointer type definition for each type.
For example, for a valuetype class T, typedef T * T_ptr
. Unlike
mapping for interfaces, the reference counting for valuetype must be implemented
by the instance of the valuetypes. The IDL compiler also generates a _var
class, which you can use instead of the _ptr. The _var class for a valuetype
automates the reference counting; that is, it automatically manages the memory
associated with the dynamically allocated object reference. When the T_var
object is deleted, the object associated with T_ptr is released. When a T_var
object is assigned a new value, the old object reference pointed to by T_ptr is
released after the assignment takes place. A casting operator is also provided
to allow you to assign a T_var to a type T_ptr.
For more information about the WebSphere CORBA value type library for C++, see the following topics:
Related concepts... | |
CORBA value type considerations | |