ROSE
0.11.145.147
src
Sawyer
SharedObject.h
1
// WARNING: Changes to this file must be contributed back to Sawyer or else they will
2
// be clobbered by the next update from Sawyer. The Sawyer repository is at
3
// https://gitlab.com/charger7534/sawyer.git.
4
5
6
7
8
#ifndef Sawyer_SharedObject_H
9
#define Sawyer_SharedObject_H
10
11
#include <Sawyer/Sawyer.h>
12
#include <Sawyer/Synchronization.h>
13
14
namespace
Sawyer
{
15
64
class
SAWYER_EXPORT
SharedObject
{
65
template
<
class
U>
friend
class
SharedPointer
;
66
mutable
SAWYER_THREAD_TRAITS::Mutex mutex_;
67
mutable
size_t
nrefs_;
68
public
:
70
SharedObject
(): nrefs_(0) {}
71
76
SharedObject
(
const
SharedObject
&): nrefs_(0) {}
77
79
virtual
~SharedObject
() {
80
ASSERT_require(nrefs_==0);
81
}
82
86
SharedObject
&
operator=
(
const
SharedObject
&) {
87
return
*
this
;
88
}
89
};
90
91
}
// namespace
92
93
#endif
Sawyer::SharedObject
Base class for reference counted objects.
Definition
SharedObject.h:64
Sawyer::SharedObject::SharedObject
SharedObject(const SharedObject &)
Copy constructor.
Definition
SharedObject.h:76
Sawyer::SharedObject::operator=
SharedObject & operator=(const SharedObject &)
Assignment.
Definition
SharedObject.h:86
Sawyer::SharedObject::~SharedObject
virtual ~SharedObject()
Virtual destructor.
Definition
SharedObject.h:79
Sawyer::SharedObject::SharedObject
SharedObject()
Default constructor.
Definition
SharedObject.h:70
Sawyer::SharedPointer
Reference-counting intrusive smart pointer.
Definition
SharedPointer.h:65
Sawyer
Sawyer support library.
Definition
FeasiblePath.h:767
Generated on Mon Sep 30 2024 03:25:38 for ROSE by
1.9.8