[Enterprise Extensions only]

Object::_is_a

Overview Determines whether an object supports a given IDL interface.
Original class CORBA::Object
Exceptions CORBA::SystemException


Intended Usage

This method is intended to be used by applications to determine whether an object reference refers to an object that supports a given IDL interface (and hence whether the reference can be successfully narrowed). When invoked on a proxy object, this call sometimes results in a remote invocation (if it cannot be determined locally).

IDL Syntax

  virtual CORBA::Boolean _is_a (const char* logical_type_id) = 0;

Input parameters

logical_type_id
The Interface Repository type identifier of an IDL interface. This is not simply the interface name. For programmer convenience, type identifers are provided by the C++ bindings, as static consts of the C++ class corresponding to the interface, using the naming convention <interface-name>::<interface-name>_CN. If this parameter value is NULL or not a valid Interface Repository type identifier, zero is returned.

Return values

CORBA::Boolean
A zero return value indicates that the object referenced by the object reference does not support the specified IDL interface. A nonzero return value indicates that it does support it. An object is considered to support the interface if it either implements it or inherits it.

Example

  /* Assume the following idl interface: */
  interface testObject {
  string testMethod (in long input_value, out float out_value);
  };
 
  /* Here is the cpp code: */
  CORBA::Object_ptr test_obj;
  /* initialize test_obj somehow */
  ...
  /* To find out if test_obj can be narrowed to testObject, use 
     CORBA::Object::_is_a and the Repository ID for the testObject interface 
     (defined in the emitted bindings as testObject::testObject_RID) */
  if (test_obj->_is_a(testObject::testObject_RID))
  testObject_ptr new_test_obj = testObject::_narrow(test_obj);
  ...