A smart pointer for the SALOME GenericObj interface. More...
#include <GEOM_GenericObjPtr.h>
Public Member Functions | |
GenericObjPtr () | |
Initialize pointer to nil generic object reference. More... | |
GenericObjPtr (TInterfacePtr theObject) | |
Initialize pointer to the given generic object reference. More... | |
GenericObjPtr (const GenericObjPtr &thePointer) | |
Initialize pointer with a new reference to the same object referenced by given pointer. More... | |
~GenericObjPtr () | |
Destroy pointer and remove the reference to the object. More... | |
GenericObjPtr & | operator= (TInterfacePtr theObject) |
Assign object to reference and remove reference to an old object. More... | |
GenericObjPtr & | operator= (const GenericObjPtr &thePointer) |
Assign object to reference and remove reference to an old object. More... | |
bool | operator== (TInterfacePtr theObject) |
Check equivalence. More... | |
bool | operator== (const GenericObjPtr &thePointer) |
Check equivalence. More... | |
bool | operator!= (TInterfacePtr theObject) |
Check difference. More... | |
bool | operator!= (const GenericObjPtr &thePointer) |
Check difference. More... | |
TInterfacePtr | operator-> () const |
Provides normal pointer target member access using operator ->. More... | |
operator bool () const | |
Check validity of the pointer. More... | |
void | take (TInterfacePtr theObject) |
Initialize pointer to the given generic object reference and take ownership on it. More... | |
TInterfacePtr | get () const |
Get the contained object. More... | |
TInterfacePtr | copy () const |
Make the copy of the contained object and return it (caller becomes owner of the CORBA reference). More... | |
bool | isNull () const |
Check if pointer is null. More... | |
void | nullify () |
Nullify pointer. More... | |
template<> | |
bool | isSame (GEOM::GEOM_Object_ptr theLeft, GEOM::GEOM_Object_ptr theRight) |
template<> | |
bool | isSame (GEOM::GEOM_Object_ptr theLeft, GEOM::GEOM_Object_ptr theRight) |
Static Public Member Functions | |
static bool | isSame (TInterfacePtr theLeft, TInterfacePtr theRight) |
Private Types | |
typedef TInterface::_var_type | TInterfaceVar |
typedef TInterface::_ptr_type | TInterfacePtr |
Private Member Functions | |
void | Register () |
Increment counter for the object. More... | |
void | UnRegister () |
Decrement counter for the object. More... | |
Private Attributes | |
TInterfaceVar | myObject |
This class can be used in conjunction with the references to the CORBA objects which interfaces are inherited from the SALOME::GenericObj CORBA interface.
The smart pointer class automatically invokes Register() / UnRegister() functions of th interface in order to prevent memory leaks and other such problems caused by improper usage of the CORBA references.
Smart pointers can be easily copied, stored within class as data members, passed to the functions requiring native CORBA reference as parameters, etc.
Usage:
Examples:
|
private |
|
private |
|
inline |
|
inline |
|
inline |
|
inline |
References GEOM::GenericObjPtr< TInterface >::UnRegister().
|
inline |
References GEOM::GenericObjPtr< TInterface >::myObject.
|
inline |
References GEOM::GenericObjPtr< TInterface >::myObject.
|
inline |
References GEOM::GenericObjPtr< TInterface >::myObject.
bool GEOM::GenericObjPtr< GEOM::GEOM_Object >::isSame | ( | GEOM::GEOM_Object_ptr | theLeft, |
GEOM::GEOM_Object_ptr | theRight | ||
) |
|
inlinestatic |
bool GEOM::GenericObjPtr< GEOM::GEOM_Object >::isSame | ( | GEOM::GEOM_Object_ptr | theLeft, |
GEOM::GEOM_Object_ptr | theRight | ||
) |
|
inline |
References GEOM::GenericObjPtr< TInterface >::UnRegister().
|
inline |
References GEOM::GenericObjPtr< TInterface >::isNull().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineprivate |
References GEOM::GenericObjPtr< TInterface >::myObject.
|
inline |
|
inlineprivate |
References GEOM::GenericObjPtr< TInterface >::myObject.
|
private |