Panda3D
cachedTypedWritableReferenceCount.cxx
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 cachedTypedWritableReferenceCount.cxx
10  * @author drose
11  * @date 2005-01-25
12  */
13 
15 
16 TypeHandle CachedTypedWritableReferenceCount::_type_handle;
17 
18 /**
19  * Does some easy checks to make sure that the reference count isn't
20  * completely bogus.
21  */
22 bool CachedTypedWritableReferenceCount::
23 do_test_ref_count_integrity() const {
24  // If this assertion fails, we're trying to delete an object that was just
25  // deleted. Possibly you used a real pointer instead of a PointerTo at some
26  // point, and the object was deleted when the PointerTo went out of scope.
27  // Maybe you tried to create an automatic (local variable) instance of a
28  // class that derives from ReferenceCount. Or maybe your headers are out of
29  // sync, and you need to make clean in direct or some higher tree.
30  nassertr(_cache_ref_count != -100, false);
31 
32  // If this assertion fails, the reference counts are all screwed up
33  // altogether. Maybe some errant code stomped all over memory somewhere.
34  nassertr(_cache_ref_count >= 0, false);
35 
36  return TypedWritableReferenceCount::do_test_ref_count_integrity();
37 }
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81