Panda3D

memoryUsagePointers.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 memoryUsagePointers.I
10 * @author drose
11 * @date 2000-05-25
12 */
13
14 /**
15 *
16 */
17 INLINE MemoryUsagePointers::Entry::
18 Entry(ReferenceCount *ref_ptr, TypedObject *typed_ptr,
19 TypeHandle type, double age) :
20 _ref_ptr(ref_ptr),
21 _typed_ptr(typed_ptr),
22 _type(type),
23 _age(age)
24 {
25 _ref_ptr->ref();
26 }
27
28 /**
29 *
30 */
31 INLINE MemoryUsagePointers::Entry::
32 Entry(const Entry &copy) :
33 _ref_ptr(copy._ref_ptr),
34 _typed_ptr(copy._typed_ptr),
35 _type(copy._type),
36 _age(copy._age)
37 {
38 _ref_ptr->ref();
39 }
40
41 /**
42 *
43 */
44 INLINE void MemoryUsagePointers::Entry::
45 operator = (const Entry &copy) {
46 if (_ref_ptr != copy._ref_ptr) {
47 _ref_ptr->unref();
48 _ref_ptr = copy._ref_ptr;
49 // We can't call unref_delete(), because we don't know what kind of
50 // pointer it is precisely. Potential leak.
51 _ref_ptr->ref();
52 }
53 _typed_ptr = copy._typed_ptr;
54 _type = copy._type;
55 _age = copy._age;
56 }
57
58 /**
59 *
60 */
61 INLINE MemoryUsagePointers::Entry::
62 ~Entry() {
63 // We can't call unref_delete(), because we don't know what kind of pointer
64 // it is precisely. Potential leak.
65 _ref_ptr->unref();
66 }
ReferenceCount
A base class for all things that want to be reference-counted.
Definition: referenceCount.h:38
TypeHandle
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
TypedObject
This is an abstract class that all classes which use TypeHandle, and also provide virtual functions t...
Definition: typedObject.h:88