A «CORBAInterface» class
can have both
attributes and operations. These elements are generated into attributes
and operations with the same names in the IDL interface.
Data
types used for attributes and operations
are
generated "as-is" in the IDL files. Therefore, you must use CORBA
data types, defined in either the predefined CORBA types package or
in your own «CORBAModule» or «CORBAInterface».
Create subclasses in the model to realize IDL interfaces
as follows:
- Every CORBA operation must have
a corresponding
C++ operation in the realizing class.
- Every
CORBA attribute must have a corresponding
C++ attribute in the realizing class. You must provide get and set operations
in the realizing class.
- Every CORBA type (for
example, long)
must have a corresponding type (for example, CORBA::long)
in the realizing class. You can import these types from the CORBA
predefined types package.
To simplify the
process, you can drag-and-drop CORBA
operations and attributes from a CORBA interface to a regular class. IBM® Rational® Rhapsody® automatically
converts the types.
The following constraints
apply to CORBA interfaces
concerning code generation:
- Both attributes
and operations of CORBA interfaces
cannot be classified as public, private, or protected. Therefore,
generated IDL files refer only to public attributes and operations.
Protected and private attributes are ignored.
- «CORBAInterface» stereotyped
classes
cannot be instantiated. Therefore, operation bodies, if they exist,
are ignored.
- The virtual, static,
and const keywords have no meaning for «CORBAInterface» classes.
Therefore, the virtual/static keyword is ignored
during IDL attribute generation.
You can
make an attribute of a CORBA interface readonly (a
CORBA keyword) by setting the attribute's CORBA::Attribute:IsReadOnly property
to True. To make an operation of a CORBA interface oneway,
set the operation's CORBA::Operation::IsOneWay property
to True.
In addition, the following
standard UML options
are available for operations:
- Operation
arguments can have a direction of in,
out, or inout. Specify these values in the Argument window.
- The CORBA::Operation::ThrowExceptions property
enables you to specify the exceptions that an operation throws. For
example, if an operation throws the exceptions exc1 and exc2,
set "exc1, exc2" for the ThrowExceptions property.