sick_visionary_cpp_shared
3pp
boost
smart_ptr
detail
sp_counted_base_nt.hpp
Go to the documentation of this file.
1
#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_NT_HPP_INCLUDED
2
#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_NT_HPP_INCLUDED
3
4
// MS compatible compilers support #pragma once
5
6
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
7
# pragma once
8
#endif
9
10
//
11
// detail/sp_counted_base_nt.hpp
12
//
13
// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd.
14
// Copyright 2004-2005 Peter Dimov
15
//
16
// Distributed under the Boost Software License, Version 1.0. (See
17
// accompanying file LICENSE_1_0.txt or copy at
18
// http://www.boost.org/LICENSE_1_0.txt)
19
//
20
21
#include <
boost/detail/sp_typeinfo.hpp
>
22
23
namespace
boost
24
{
25
26
namespace
detail
27
{
28
29
class
sp_counted_base
30
{
31
private
:
32
33
sp_counted_base
(
sp_counted_base
const
& );
34
sp_counted_base
&
operator=
(
sp_counted_base
const
& );
35
36
long
use_count_
;
// #shared
37
long
weak_count_
;
// #weak + (#shared != 0)
38
39
public
:
40
41
sp_counted_base
():
use_count_
( 1 ),
weak_count_
( 1 )
42
{
43
}
44
45
virtual
~sp_counted_base
()
// nothrow
46
{
47
}
48
49
// dispose() is called when use_count_ drops to zero, to release
50
// the resources managed by *this.
51
52
virtual
void
dispose
() = 0;
// nothrow
53
54
// destroy() is called when weak_count_ drops to zero.
55
56
virtual
void
destroy
()
// nothrow
57
{
58
delete
this
;
59
}
60
61
virtual
void
*
get_deleter
(
sp_typeinfo
const
& ti ) = 0;
62
virtual
void
*
get_untyped_deleter
() = 0;
63
64
void
add_ref_copy
()
65
{
66
++
use_count_
;
67
}
68
69
bool
add_ref_lock
()
// true on success
70
{
71
if
(
use_count_
== 0 )
return
false
;
72
++
use_count_
;
73
return
true
;
74
}
75
76
void
release
()
// nothrow
77
{
78
if
( --
use_count_
== 0 )
79
{
80
dispose
();
81
weak_release
();
82
}
83
}
84
85
void
weak_add_ref
()
// nothrow
86
{
87
++
weak_count_
;
88
}
89
90
void
weak_release
()
// nothrow
91
{
92
if
( --
weak_count_
== 0 )
93
{
94
destroy
();
95
}
96
}
97
98
long
use_count
() const
// nothrow
99
{
100
return
use_count_
;
101
}
102
};
103
104
}
// namespace detail
105
106
}
// namespace boost
107
108
#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_NT_HPP_INCLUDED
boost::detail::sp_counted_base::get_untyped_deleter
virtual void * get_untyped_deleter()=0
boost
BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE.
boost::detail::sp_counted_base::destroy
virtual void destroy()
Definition:
sp_counted_base_nt.hpp:56
boost::detail::sp_counted_base::add_ref_copy
void add_ref_copy()
Definition:
sp_counted_base_nt.hpp:64
sp_typeinfo.hpp
boost::detail::sp_counted_base::weak_release
void weak_release()
Definition:
sp_counted_base_acc_ia64.hpp:133
boost::detail::sp_counted_base::add_ref_lock
bool add_ref_lock()
Definition:
sp_counted_base_nt.hpp:69
boost::detail::sp_typeinfo
boost::core::typeinfo sp_typeinfo
Definition:
sp_typeinfo.hpp:28
boost::detail::sp_counted_base::get_deleter
virtual void * get_deleter(sp_typeinfo const &ti)=0
boost::detail::sp_counted_base::use_count
long use_count() const
Definition:
sp_counted_base_nt.hpp:98
boost::detail::sp_counted_base::dispose
virtual void dispose()=0
boost::detail::sp_counted_base::~sp_counted_base
virtual ~sp_counted_base()
Definition:
sp_counted_base_nt.hpp:45
boost::detail::sp_counted_base::operator=
sp_counted_base & operator=(sp_counted_base const &)
boost::detail::sp_counted_base::sp_counted_base
sp_counted_base()
Definition:
sp_counted_base_acc_ia64.hpp:86
boost::detail::sp_counted_base::release
void release()
Definition:
sp_counted_base_nt.hpp:76
boost::detail::sp_counted_base::use_count_
int use_count_
Definition:
sp_counted_base_acc_ia64.hpp:81
boost::detail::sp_counted_base::weak_count_
int weak_count_
Definition:
sp_counted_base_acc_ia64.hpp:82
boost::detail::sp_counted_base::weak_add_ref
void weak_add_ref()
Definition:
sp_counted_base_nt.hpp:85
sick_visionary_ros
Author(s): SICK AG TechSupport 3D Snapshot
autogenerated on Thu Feb 8 2024 03:48:40