|
Teuchos Package Browser (Single Doxygen Collection)
Version of the Day
|
Generic templated handle class. More...
#include <Teuchos_Handle.hpp>

Public Member Functions | |
| Handle () | |
| | |
| Handle (const RCP< PointerType > &smartPtr) | |
| Construct with an existing RCP. | |
| Handle (Handleable< PointerType > *rawPtr) | |
| Construct with a raw pointer to a Handleable. | |
| RCP< PointerType > | ptr () const |
| Read/write access to the underlying smart pointer. | |
| PointerType * | rawPtr () const |
| Access to non-const raw pointer. | |
Generic templated handle class.
In writing derived types, it is usually simplest to use the TEUCHOS_HANDLE_CTORS macro to generate boilerplate constructor code.
There are two modes of construction: construction from an existing RCP,
RCP<Base> r = rcp(new Derived(blahblah)); Handle<Base> h = r;
and construction from a raw pointer,
Handle<Base> h = new Derived(blahblah);
The second form makes the code slightly cleaner. Note that to use this second form, it is necessary that Derived implement the Handleable interface; this is necessary to avoid any implicit conversions from raw pointers to smart pointers.
Note that the first form must be used whenever the object being handled has been allocated on the stack.
Definition at line 135 of file Teuchos_Handle.hpp.
| Teuchos::Handle< PointerType >::Handle | ( | ) | [inline] |
Definition at line 139 of file Teuchos_Handle.hpp.
| Teuchos::Handle< PointerType >::Handle | ( | const RCP< PointerType > & | smartPtr | ) | [inline] |
Construct with an existing RCP.
Definition at line 142 of file Teuchos_Handle.hpp.
| Teuchos::Handle< PointerType >::Handle | ( | Handleable< PointerType > * | rawPtr | ) | [inline, explicit] |
Construct with a raw pointer to a Handleable.
This will make a call to rcp() internally, thus removing that call from the user interface.
Definition at line 153 of file Teuchos_Handle.hpp.
| RCP<PointerType> Teuchos::Handle< PointerType >::ptr | ( | ) | const [inline] |
Read/write access to the underlying smart pointer.
Definition at line 161 of file Teuchos_Handle.hpp.
| PointerType* Teuchos::Handle< PointerType >::rawPtr | ( | ) | const [inline] |
Access to non-const raw pointer.
Definition at line 163 of file Teuchos_Handle.hpp.
1.7.6.1