PSCF v1.4.0
CountedReference.h
1#ifndef UTIL_COUNTED_REFERENCE_H
2#define UTIL_COUNTED_REFERENCE_H
3
4/*
5* Util Package - C++ Utilities for Scientific Computation
6*
7* Copyright 2010 - 2026, The Regents of the University of Minnesota
8* Distributed under the terms of the GNU General Public License.
9*/
10
11namespace Util {
12
13 // Forward reference
14 class ReferenceCounter;
15
50 {
51 public:
52
57
61 bool isAssociated() const;
62
76 void associate(ReferenceCounter& counter);
77
88 void dissociate();
89
90 private:
91
92 // Pointer to associated ReferenceCounter, if any.
93 ReferenceCounter* ptr_;
94
95 };
96
100 inline
102 { return (bool) ptr_; }
103
104} // namespace Util
105#endif
void associate(ReferenceCounter &counter)
Create an association with a ReferenceCounter.
bool isAssociated() const
Is this associated with a ReferenceCounter?
void dissociate()
Destroy an association with a ReferenceCounter.
Reference counter.
Utility classes for scientific computation.