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
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 */ } ...