Teuchos - Trilinos Tools Package
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
core
src
Teuchos_RCPBoostSharedPtrConversionsDecl.hpp
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_RCP_BOOST_SHAREDPTR_CONVERSIONS_DECL_HPP
11
#define TEUCHOS_RCP_BOOST_SHAREDPTR_CONVERSIONS_DECL_HPP
12
13
#include "
Teuchos_RCPDecl.hpp
"
14
#include "boost/shared_ptr.hpp"
15
16
17
namespace
Teuchos
{
18
19
32
33
39
template
<
class
T>
40
class
DeallocBoostSharedPtr
41
{
42
public
:
44
DeallocBoostSharedPtr
(
const
boost::shared_ptr<T> &sptr ) : sptr_(sptr) {}
46
typedef
T
ptr_t
;
48
void
free
( T* ptr_in )
const
{ sptr_.reset(); }
50
const
boost::shared_ptr<T>&
ptr
()
const
{
return
sptr_; }
51
private
:
52
mutable
boost::shared_ptr<T> sptr_;
53
DeallocBoostSharedPtr
();
// Not defined and not to be called!
54
};
55
56
62
template
<
class
T>
63
class
RCPDeleter
64
{
65
public
:
67
RCPDeleter
(
const
RCP<T>
&
rcp
) : rcp_(
rcp
) {}
69
typedef
void
result_type
;
71
typedef
T *
argument_type
;
73
void
operator()
(T * x)
const
{ rcp_ = null; }
75
const
RCP<T>
&
ptr
()
const
{
return
rcp_; }
76
private
:
77
mutable
RCP<T>
rcp_;
78
RCPDeleter
();
// Not defined and not to be called!
79
};
80
81
92
template
<
class
T>
93
RCP<T>
rcp
(
const
boost::shared_ptr<T> &sptr );
94
95
107
template
<
class
T>
108
boost::shared_ptr<T>
shared_pointer
(
const
RCP<T>
&
rcp
);
109
110
111
}
// namespace Teuchos
112
113
114
namespace
boost {
115
116
121
template
<
class
T>
inline
122
bool
is_null
(
const
boost::shared_ptr<T> &p )
123
{
124
return
p.get() == 0;
125
}
126
127
132
template
<
class
T>
inline
133
bool
nonnull
(
const
boost::shared_ptr<T> &p )
134
{
135
return
p.get() != 0;
136
}
137
138
139
}
// namespace boost
140
141
142
#endif
// TEUCHOS_RCP_BOOST_SHAREDPTR_CONVERSIONS_DECL_HPP
Teuchos_RCPDecl.hpp
Reference-counted pointer class and non-member templated function implementations.
Teuchos::DeallocBoostSharedPtr::ptr_t
T ptr_t
Definition
Teuchos_RCPBoostSharedPtrConversionsDecl.hpp:46
Teuchos::DeallocBoostSharedPtr::free
void free(T *ptr_in) const
Definition
Teuchos_RCPBoostSharedPtrConversionsDecl.hpp:48
Teuchos::DeallocBoostSharedPtr::DeallocBoostSharedPtr
DeallocBoostSharedPtr(const boost::shared_ptr< T > &sptr)
Definition
Teuchos_RCPBoostSharedPtrConversionsDecl.hpp:44
Teuchos::DeallocBoostSharedPtr::ptr
const boost::shared_ptr< T > & ptr() const
Definition
Teuchos_RCPBoostSharedPtrConversionsDecl.hpp:50
Teuchos::RCPDeleter::result_type
void result_type
Definition
Teuchos_RCPBoostSharedPtrConversionsDecl.hpp:69
Teuchos::RCPDeleter::operator()
void operator()(T *x) const
Definition
Teuchos_RCPBoostSharedPtrConversionsDecl.hpp:73
Teuchos::RCPDeleter::argument_type
T * argument_type
Definition
Teuchos_RCPBoostSharedPtrConversionsDecl.hpp:71
Teuchos::RCPDeleter::RCPDeleter
RCPDeleter(const RCP< T > &rcp)
Definition
Teuchos_RCPBoostSharedPtrConversionsDecl.hpp:67
Teuchos::RCPDeleter::ptr
const RCP< T > & ptr() const
Definition
Teuchos_RCPBoostSharedPtrConversionsDecl.hpp:75
Teuchos::RCP
Smart reference counting pointer class for automatic garbage collection.
Definition
Teuchos_RCPDecl.hpp:397
Teuchos::RCP< T_impl >::RCP
RCP(ENull null_arg=null)
Teuchos::RCP::shared_pointer
boost::shared_ptr< T > shared_pointer(const RCP< T > &rcp)
Conversion function that takes in a Teuchos::RCP object and spits out a boost::shared_ptr object.
Teuchos::RCP::rcp
RCP< T > rcp(const boost::shared_ptr< T > &sptr)
Conversion function that takes in a boost::shared_ptr object and spits out a Teuchos::RCP object.
boost::is_null
bool is_null(const boost::shared_ptr< T > &p)
Returns true if p.get()==NULL.
Definition
Teuchos_RCPBoostSharedPtrConversionsDecl.hpp:122
boost::nonnull
bool nonnull(const boost::shared_ptr< T > &p)
Returns true if p.get()!=NULL.
Definition
Teuchos_RCPBoostSharedPtrConversionsDecl.hpp:133
Teuchos
The Teuchos namespace contains all of the classes, structs and enums used by Teuchos,...
Teuchos::rcp
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Deprecated.
Definition
Teuchos_RCPDecl.hpp:1234
Generated by
1.17.0