Panda3D
 All Classes Functions Variables Enumerations
weakReferenceList.h
1 // Filename: weakReferenceList.h
2 // Created by: drose (27Sep04)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef WEAKREFERENCELIST_H
16 #define WEAKREFERENCELIST_H
17 
18 #include "pandabase.h"
19 #include "pset.h"
20 #include "mutexImpl.h"
21 
22 class WeakPointerToVoid;
23 
24 ////////////////////////////////////////////////////////////////////
25 // Class : WeakReferenceList
26 // Description : This is a list of WeakPointerTo's that share a
27 // reference to a given ReferenceCount object. It is
28 // stored in a separate class since it is assumed that
29 // most ReferenceCount objects do not need to store this
30 // list at all; this avoids bloating every
31 // ReferenceCount object in the world with the size of
32 // this object.
33 ////////////////////////////////////////////////////////////////////
34 class EXPCL_PANDAEXPRESS WeakReferenceList {
35 public:
38 
39  void add_reference(WeakPointerToVoid *ptv);
40  void clear_reference(WeakPointerToVoid *ptv);
41 
42 private:
44  Pointers _pointers;
45  MutexImpl _lock;
46 };
47 
48 #include "weakReferenceList.I"
49 
50 #endif
This is the specialization of PointerToVoid for weak pointers.
This is a list of WeakPointerTo's that share a reference to a given ReferenceCount object...
A fake mutex implementation for single-threaded applications that don't need any synchronization cont...