Teuchos Package Browser (Single Doxygen Collection) Version of the Day
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Teuchos::ConstHandleable< Base > Class Template Referenceabstract

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

#include <Teuchos_Handleable.hpp>

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

Public Member Functions

virtual ~ConstHandleable ()
 
virtual RCP< const Base > getConstRcp () const =0
 Virtual dtorReturn a safely-created RCP to the base type.
 

Detailed Description

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

Class ConstHandleable provides an abstract interface for polymorphic conversion from raw pointers to const 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

Templated handle class with strong const protection.
Concrete serial communicator subclass.

impossible with the straightforward implementation in which ConstHandle 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 ConstHandleable<Base>, where ConstHandleable<Base> provides a getConstRcp() method which returns the result of a call to rcp() on this.

Definition at line 66 of file Teuchos_Handleable.hpp.

Constructor & Destructor Documentation

◆ ~ConstHandleable()

template<typename Base >
virtual Teuchos::ConstHandleable< Base >::~ConstHandleable ( )
inlinevirtual

Definition at line 70 of file Teuchos_Handleable.hpp.

Member Function Documentation

◆ getConstRcp()

template<typename Base >
virtual RCP< const Base > Teuchos::ConstHandleable< Base >::getConstRcp ( ) const
pure virtual

Virtual dtorReturn a safely-created RCP to the base type.


The documentation for this class was generated from the following file: