|
Teuchos Package Browser (Single Doxygen Collection)
Version of the Day
|
Templated handle class with strong const protection. More...
#include <Teuchos_Handle.hpp>

Public Member Functions | |
| ConstHandle (const RCP< const PointerType > &ptr) | |
| Construct with an existing RCP. | |
| ConstHandle (const ConstHandleable< PointerType > *ptr) | |
| Construct with a raw pointer to a ConstHandleable. This will make a call to rcp(), thus removing that call from the user interface. | |
| const RCP< const PointerType > & | constPtr () const |
| Read-only access to the underlying smart pointer. | |
| const PointerType *const | rawPtr () |
| Access to raw pointer. | |
Protected Member Functions | |
| ConstHandle () | |
| The empty ctor will only be called by Handle ctors. | |
| void | setRcp (const RCP< PointerType > &ptr) |
| This function is needed in Handle ctors. | |
| RCP< PointerType > | nonConstPtr () const |
| Protected non-const access to the underlying smart pointer. | |
Private Attributes | |
| RCP< const PointerType > | ptr_ |
| | |
Templated handle class with strong const protection.
In writing derived types, it is usually simplest to use the TEUCHOS_CONST_HANDLE_CTORS macro to generate boilerplate constructor code.
There are two modes of construction: construction from an existing RCP,
RCP<const Base> r = rcp(new Derived(blahblah)); ConstHandle<Base> h = r;
and construction from a raw pointer,
ConstHandle<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 ConstHandleable interface; this is necessary to avoid any implicit conversions from just any raw pointer to a smart pointer.
Note that the first form with rcp() must be used whenever the object being handled has been allocated on the stack (using rcp(ptr,false) of course).
Definition at line 79 of file Teuchos_Handle.hpp.
| Teuchos::ConstHandle< PointerType >::ConstHandle | ( | const RCP< const PointerType > & | ptr | ) | [inline] |
Construct with an existing RCP.
Definition at line 83 of file Teuchos_Handle.hpp.
| Teuchos::ConstHandle< PointerType >::ConstHandle | ( | const ConstHandleable< PointerType > * | ptr | ) | [inline, explicit] |
Construct with a raw pointer to a ConstHandleable. This will make a call to rcp(), thus removing that call from the user interface.
Definition at line 86 of file Teuchos_Handle.hpp.
| Teuchos::ConstHandle< PointerType >::ConstHandle | ( | ) | [inline, explicit, protected] |
The empty ctor will only be called by Handle ctors.
Definition at line 93 of file Teuchos_Handle.hpp.
| const RCP<const PointerType>& Teuchos::ConstHandle< PointerType >::constPtr | ( | ) | const [inline] |
Read-only access to the underlying smart pointer.
Definition at line 88 of file Teuchos_Handle.hpp.
| const PointerType* const Teuchos::ConstHandle< PointerType >::rawPtr | ( | ) | [inline] |
Access to raw pointer.
Definition at line 90 of file Teuchos_Handle.hpp.
| void Teuchos::ConstHandle< PointerType >::setRcp | ( | const RCP< PointerType > & | ptr | ) | [inline, protected] |
This function is needed in Handle ctors.
The Handle ctors call the empty ConstHandle ctor and then set the pointer in the ConstHandle with a call to setRcp().
Definition at line 98 of file Teuchos_Handle.hpp.
| RCP<PointerType> Teuchos::ConstHandle< PointerType >::nonConstPtr | ( | ) | const [inline, protected] |
Protected non-const access to the underlying smart pointer.
This will be called by the nonConstPtr() method of the non-const Handle subclass
Definition at line 104 of file Teuchos_Handle.hpp.
RCP<const PointerType> Teuchos::ConstHandle< PointerType >::ptr_ [private] |
Definition at line 108 of file Teuchos_Handle.hpp.
1.7.6.1