Panda3D
Loading...
Searching...
No Matches
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 */
20ref() 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 */
32unref() 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 */
43was_deleted() const {
44 return AtomicAdjust::get(_count) < _alive_offset;
45}
static bool dec(Integer &var)
Atomically decrements the indicated variable and returns true if the new value is nonzero,...
static void inc(Integer &var)
Atomically increments the indicated variable.
static Integer get(const Integer &var)
Atomically retrieves the snapshot value of the indicated variable.
bool was_deleted() const
Returns true if the object represented has been deleted, ie.
void ref() const
Increases the number of weak references.
bool unref() const
Decreases the number of weak references.