Teuchos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Teuchos_Handleable.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Teuchos: Common Tools Package
4 //
5 // Copyright 2004 NTESS and the Teuchos contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef TEUCHOS_HANDLEABLE_HPP
11 #define TEUCHOS_HANDLEABLE_HPP
12 
13 #include "Teuchos_ConfigDefs.hpp"
14 #include "Teuchos_RCP.hpp"
15 
16 
17 namespace Teuchos
18 {
33  template <typename Base>
35  {
36  public:
38  virtual ~ConstHandleable(){}
39 
42  virtual RCP<const Base> getConstRcp() const = 0 ;
43  };
44 
59  template <typename Base>
60  class Handleable : public virtual ConstHandleable<Base>
61  {
62  public:
63 
65  virtual ~Handleable(){;}
66 
68  virtual RCP<Base> getRcp() = 0 ;
69 
70  };
71 }
72 
73 
87 #define TEUCHOS_GET_RCP(Base) \
88  virtual Teuchos::RCP<const Base > getConstRcp() const {return rcp(this);} \
89  virtual Teuchos::RCP<Base > getRcp() {return rcp(this);}
90 
102 #define TEUCHOS_GET_CONST_RCP(Base) \
103 virtual Teuchos::RCP<const Base > getConstRcp() const {return rcp(this);}
104 
105 
106 
107 
108 #endif // TEUCHOS_HANDLEABLE_HPP
Teuchos header file which uses auto-configuration information to include necessary C++ headers...
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...
virtual RCP< const Base > getConstRcp() const =0
Virtual dtorReturn a safely-created RCP to the base type.
Class ConstHandleable provides an abstract interface for polymorphic conversion from raw pointers to ...
Smart reference counting pointer class for automatic garbage collection.
Reference-counted pointer class and non-member templated function implementations.