Teuchos Package Browser (Single Doxygen Collection) Version of the Day
Public Member Functions
Teuchos::Handleable< Base > Class Template Reference

Class Handleable provides an abstract interface for polymorphic conversion from raw pointers to smart pointers. More...

#include <Teuchos_Handleable.hpp>

Inheritance diagram for Teuchos::Handleable< Base >:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual ~Handleable ()
 
virtual RCP< Base > getRcp ()=0
 Return a safely-created RCP to the base type.

Detailed Description

template<typename Base>
class Teuchos::Handleable< Base >

Class Handleable provides an abstract interface for polymorphic conversion from raw pointers to smart pointers.

Recall from the Teuchos RCP documentation that one should never create directly a smart pointer from a raw pointer; rather, smart pointers should be created through a call to rcp(). The type of the argument to rcp() must be known at compile time. This makes the syntax

 Handle h = new Derived(); 

impossible with the straightforward implementation in which Handle takes a raw pointer to a Base. In order to preserve this clean syntax, we require any handles supporting this syntax to take a raw pointer to a Handleable<Base>, where Handleable<Base> provides a getRcp() method which returns the result of a call to rcp() on this.

Definition at line 92 of file Teuchos_Handleable.hpp.


Constructor & Destructor Documentation

template<typename Base>
virtual Teuchos::Handleable< Base >::~Handleable ( ) [inline, virtual]

Definition at line 97 of file Teuchos_Handleable.hpp.


Member Function Documentation

template<typename Base>
virtual RCP<Base> Teuchos::Handleable< Base >::getRcp ( ) [pure virtual]

Return a safely-created RCP to the base type.

Implemented in VecA.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines