10 #ifndef TEUCHOS_HANDLE_HPP
11 #define TEUCHOS_HANDLE_HPP
15 #include "Teuchos_Describable.hpp"
16 #include "Teuchos_Handleable.hpp"
46 template <
typename Po
interType>
67 {ptr_=rcp_const_cast<
const PointerType>(ptr);}
73 {
return rcp_const_cast<PointerType>(ptr_);}
102 template <
typename Po
interType>
147 #define TEUCHOS_HANDLE_CTORS(handle, contents) \
148 handle() : Teuchos::Handle<contents >() {;} \
149 handle(Teuchos::Handleable<contents >* rawPtr) : Teuchos::Handle<contents >(rawPtr) {;} \
150 handle(const Teuchos::RCP<contents >& smartPtr) : Teuchos::Handle<contents >(smartPtr){;}
163 #define TEUCHOS_CONST_HANDLE_CTORS(handle, contents) \
164 handle( Teuchos::ENull _null = Teuchos::null ) : Teuchos::ConstHandle<contents >() {;} \
165 handle(const Teuchos::ConstHandleable<contents >* rawPtr) : Teuchos::ConstHandle<contents >(rawPtr) {;} \
166 handle(const Teuchos::RCP<const contents >& smartPtr) : Teuchos::ConstHandle<contents >(smartPtr){;}
168 #endif // TEUCHOS_CONSTHANDLE_HPP
Templated handle class with strong const protection.
RCP< PointerType > nonConstPtr() const
Protected non-const access to the underlying smart pointer.
Handle(const RCP< PointerType > &smartPtr)
Construct with an existing RCP.
Handle(Handleable< PointerType > *rawPtr)
Construct with a raw pointer to a Handleable.
Generic templated handle class.
Teuchos header file which uses auto-configuration information to include necessary C++ headers...
ConstHandle()
The empty ctor will only be called by Handle ctors.
T * get() const
Get the raw C++ pointer to the underlying object.
virtual RCP< Base > getRcp()=0
Return a safely-created RCP to the base type.
Class Handleable provides an abstract interface for polymorphic conversion from raw pointers to smart...
RCP< PointerType > ptr() const
Read/write access to the underlying smart pointer.
void setRcp(const RCP< PointerType > &ptr)
This function is needed in Handle ctors.
const PointerType *const rawPtr()
Access to raw pointer.
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.
ConstHandle(const RCP< const PointerType > &ptr)
Construct with an existing RCP.
Class ConstHandleable provides an abstract interface for polymorphic conversion from raw pointers to ...
Base class for all objects that can describe themselves.
PointerType * rawPtr() const
Access to non-const raw pointer.
const RCP< const PointerType > & constPtr() const
Read-only access to the underlying smart pointer.
Reference-counted pointer class and non-member templated function implementations.