Teuchos Package Browser (Single Doxygen Collection) Version of the Day
Generic templated handle class. More...
|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.
|Teuchos::Handle< PointerType >::Handle||(||const RCP< PointerType > &||smartPtr||)||
|Teuchos::Handle< PointerType >::Handle||(||Handleable< PointerType > *||rawPtr||)||
|RCP<PointerType> Teuchos::Handle< PointerType >::ptr||(||)|| const
|PointerType* Teuchos::Handle< PointerType >::rawPtr||(||)|| const