13.1.21 Interfaces
An interface in OMG IDL is mapped to a C++ class. This class contains the definitions of the operations, attributes, constants, and user-defined types (UDTs) contained in the OMG IDL interface.
For an interface INTF, the generated interface code contains the following items:
- Object reference type (INTF
_ptr
) - Object reference variable type
(INTF
_var
) -
_duplicate
static member function -
_narrow
static member function -
_nil
static member function - UDTs
- Member functions for attributes and operations
For example, consider the following OMG IDL definition:
// OMG IDL
module INVENT
{
interface Order
{
void cancelOrder ();
};
};
This definition maps to C++ as follows:
// C++
class INVENT
{
. . .
class Order;
typedef Order * Order_ptr;
class Order : public virtual CORBA::Object
{
. . .
static Order_ptr _duplicate(Order_ptr obj);
static Order_ptr _narrow(CORBA::Object_ptr obj);
static Order_ptr _nil();
virtual void cancelOrder () = 0;
. . .
};
};
The object reference types and static member functions are described in the following sections, as are UDTs, operations, and attributes.
Parent topic: Mappings