Object::_this

Overview Returns a duplicated object reference for the object implementation on which this operation was invoked.
Original class CORBA::Object


Intended Usage

This method is used within an implementation of an IDL interface, to obtain a duplicate of the object on which an operation was invoked. Calling _this() within an IDL operation implementation is not equivalent to calling _duplicate(this), because an object reference is not necessarily the object itself. To be CORBA compliant, an implementation should use _this() instead of _duplicate(this). In addition, even though _this() is implemented today as a non-virtual method on CORBA::Object, and on all the C++ interface classes generated for each interface, an implementation may not assume that it will always be implemented in this way. It may only assume that "_this()" is available within the scope of the implementation, and will always return the correct object reference for the interface that corresponds to the implementation.

_this() may not be used by a client. A client who already holds an object reference may use 'InterfaceName'::_narrow(objref) to obtain an object reference to a more derived interface whose name is 'InterfaceName'. It can also rely on automatic C++ conversion to obtain an object reference to a parent interface.

Syntax

  CORBA::Object_ptr _this();

Input parameters

None.

Return values

CORBA::Object_ptr
A duplicate of the object reference on which CORBA::Object::_this was invoked. The caller assumes ownership of this object reference and should subsequently either CORBA::release it or transfer ownership of it to another party.

Example

  /* Assume the following IDL interface */
  interface testObject
  {
    testObject testMethod ( );
  };
 
  /* Here is the cpp code that might appear in 
     an implementation of testObject::testMethod
   */
  testObject_ptr MyImplementation::testMethod() 
  {
    return _this();      /* duplicates and returns self */
  }
  ...
 

Related reference
CORBA module



Searchable topic ID:   rcor_modo12
Last updated: Jun 21, 2007 8:07:48 PM CDT    WebSphere Business Integration Server Foundation, Version 5.0.2
http://publib.boulder.ibm.com/infocenter/wasinfo/index.jsp?topic=/com.ibm.wasee.doc/info/ee/corba/ref/rcor_modo12.html

Library | Support | Terms of Use | Feedback