Language Mapping for Interfaces (cont)
  • Each class derived from an interface has a small collection of static utility methods (Code Sample 4)
    • The _nil() method returns a reference to the nil object for this type
    • The _duplicate() method is used for reference counting (garbage collection)
    • The _narrow() methods are safe casting operations
      • Because of potential loss of typing information (due to the IIOP specification) a CORBA object may not be represented by a C++ instance of the most specific type.
      • The _narrow() methods provide a way to test the type of the CORBA object and recover a properly typed C++ object.
    • The last 3 methods are used to implement _narrow().
    • _narrow_helper() is essentially a static method (does not access instance state), but must be declared as an instance method in order to be virtual

Next Slide >>