Panda3D
weakReferenceList.I
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file weakReferenceList.I
10  * @author drose
11  * @date 2004-09-27
12  */
13 
14 /**
15  * Increases the number of weak references.
16  *
17  * @since 1.10.0
18  */
19 INLINE void WeakReferenceList::
20 ref() const {
21  AtomicAdjust::inc(_count);
22 }
23 
24 /**
25  * Decreases the number of weak references. Returns true if, after this,
26  * there are still any weak or strong references remaining, or false if this
27  * structure should be deleted right away.
28  *
29  * @since 1.10.0
30  */
31 INLINE bool WeakReferenceList::
32 unref() const {
33  return AtomicAdjust::dec(_count);
34 }
35 
36 /**
37  * Returns true if the object represented has been deleted, ie. there are only
38  * weak references left pointing to the object.
39  *
40  * @since 1.10.0
41  */
42 INLINE bool WeakReferenceList::
43 was_deleted() const {
44  return AtomicAdjust::get(_count) < _alive_offset;
45 }
void ref() const
Increases the number of weak references.
bool was_deleted() const
Returns true if the object represented has been deleted, ie.
static void inc(Integer &var)
Atomically increments the indicated variable.
static bool dec(Integer &var)
Atomically decrements the indicated variable and returns true if the new value is nonzero,...
static Integer get(const Integer &var)
Atomically retrieves the snapshot value of the indicated variable.
bool unref() const
Decreases the number of weak references.