A smart pointer for the SALOME GenericObj interface. More...
#include <GEOM_GenericObjPtr.h>
Public Member Functions | |
| GenericObjPtr () | |
| Initialize pointer to nil generic object reference. | |
| GenericObjPtr (TInterfacePtr theObject) | |
| Initialize pointer to the given generic object reference. | |
| GenericObjPtr (const GenericObjPtr &thePointer) | |
| Initialize pointer with a new reference to the same object referenced by given pointer. | |
| ~GenericObjPtr () | |
| Destroy pointer and remove the reference to the object. | |
| GenericObjPtr & | operator= (TInterfacePtr theObject) |
| Assign object to reference and remove reference to an old object. | |
| GenericObjPtr & | operator= (const GenericObjPtr &thePointer) |
| Assign object to reference and remove reference to an old object. | |
| bool | operator== (TInterfacePtr theObject) |
| Check equivalence. | |
| bool | operator== (const GenericObjPtr &thePointer) |
| Check equivalence. | |
| bool | operator!= (TInterfacePtr theObject) |
| Check difference. | |
| bool | operator!= (const GenericObjPtr &thePointer) |
| Check difference. | |
| TInterfacePtr | operator-> () const |
| Provides normal pointer target member access using operator ->. | |
| operator bool () const | |
| Check validity of the pointer. | |
| void | take (TInterfacePtr theObject) |
| Initialize pointer to the given generic object reference and take ownership on it. | |
| TInterfacePtr | get () const |
| Get the contained object. | |
| TInterfacePtr | copy () const |
| Make the copy of the contained object and return it (caller becomes owner of the CORBA reference). | |
| bool | isNull () const |
| Check if pointer is null. | |
| void | nullify () |
| Nullify pointer. | |
| template<> | |
| dn46 SALOME series6x631 GEOM Mandriva2010 GEOM_SRC src GEOMBase GEOM_GenericObjPtr cxx bool | isSame (GEOM::GEOM_Object_ptr theLeft, GEOM::GEOM_Object_ptr theRight) |
| template<> | |
| bool GEOMBASE_EXPORT | 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. | |
| void | UnRegister () |
| Decrement counter for the object. | |
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:
typedef GEOM::GenericObjPtr<MyInterface> MyIPtr; void MyInterface_ptr foo(); void MyInterface_ptr bar( MyInterface_ptr p ); MyIPtr v1; // create empty (nil) pointer MyIPtr v2 = foo(); // get some CORBA reference and store it within the smart pointer v1 = v2; // copy smart pointer (reference counter is incremented) v2 = bar( v1.get() ); // pass smart pointer to the function MyInterface_var var = v2.copy(); // initialize _var variable with the smart pointer contents v1.take( foo() ); // take ownership on the newly created object
typedef TInterface::_var_type GEOM.GenericObjPtr< TInterface >.TInterfaceVar [private] |
typedef TInterface::_ptr_type GEOM.GenericObjPtr< TInterface >.TInterfacePtr [private] |
| GEOM.GenericObjPtr< TInterface >.GenericObjPtr | ( | ) |
| GEOM.GenericObjPtr< TInterface >.GenericObjPtr | ( | TInterfacePtr | theObject | ) |
| GEOM.GenericObjPtr< TInterface >.GenericObjPtr | ( | const GenericObjPtr< TInterface > & | thePointer | ) |
| GEOM.GenericObjPtr< TInterface >.~GenericObjPtr | ( | ) |
References GEOM.GenericObjPtr< TInterface >.UnRegister().
| void GEOM.GenericObjPtr< TInterface >.Register | ( | ) | [private] |
References GEOM.GenericObjPtr< TInterface >.myObject.
| void GEOM.GenericObjPtr< TInterface >.UnRegister | ( | ) | [private] |
References GEOM.GenericObjPtr< TInterface >.myObject.
| GenericObjPtr& GEOM.GenericObjPtr< TInterface >.operator= | ( | TInterfacePtr | theObject | ) |
| GenericObjPtr& GEOM.GenericObjPtr< TInterface >.operator= | ( | const GenericObjPtr< TInterface > & | thePointer | ) |
| static bool GEOM.GenericObjPtr< TInterface >.isSame | ( | TInterfacePtr | theLeft, |
| TInterfacePtr | theRight | ||
| ) | [static] |
| bool GEOM.GenericObjPtr< TInterface >.operator== | ( | TInterfacePtr | theObject | ) |
| bool GEOM.GenericObjPtr< TInterface >.operator== | ( | const GenericObjPtr< TInterface > & | thePointer | ) |
| bool GEOM.GenericObjPtr< TInterface >.operator!= | ( | TInterfacePtr | theObject | ) |
| bool GEOM.GenericObjPtr< TInterface >.operator!= | ( | const GenericObjPtr< TInterface > & | thePointer | ) |
| TInterfacePtr GEOM.GenericObjPtr< TInterface >.operator-> | ( | ) | const |
| GEOM.GenericObjPtr< TInterface >.operator bool | ( | ) | const |
References GEOM.GenericObjPtr< TInterface >.isNull().
| void GEOM.GenericObjPtr< TInterface >.take | ( | TInterfacePtr | theObject | ) |
| TInterfacePtr GEOM.GenericObjPtr< TInterface >.get | ( | ) | const |
References GEOM.GenericObjPtr< TInterface >.myObject.
| TInterfacePtr GEOM.GenericObjPtr< TInterface >.copy | ( | ) | const |
References GEOM.GenericObjPtr< TInterface >.myObject.
| bool GEOM.GenericObjPtr< TInterface >.isNull | ( | ) | const |
References GEOM.GenericObjPtr< TInterface >.myObject.
| void GEOM.GenericObjPtr< TInterface >.nullify | ( | ) |
References GEOM.GenericObjPtr< TInterface >.UnRegister().
| dn46 SALOME series6x631 GEOM Mandriva2010 GEOM_SRC src GEOMBase GEOM_GenericObjPtr cxx bool GEOM::GenericObjPtr< GEOM::GEOM_Object >::isSame | ( | GEOM::GEOM_Object_ptr | theLeft, |
| GEOM::GEOM_Object_ptr | theRight | ||
| ) |
| bool GEOMBASE_EXPORT GEOM::GenericObjPtr< GEOM::GEOM_Object >::isSame | ( | GEOM::GEOM_Object_ptr | theLeft, |
| GEOM::GEOM_Object_ptr | theRight | ||
| ) |
TInterfaceVar GEOM.GenericObjPtr< TInterface >.myObject [private] |