Panda3D
geomCacheEntry.h
1 // Filename: geomCacheEntry.h
2 // Created by: drose (21Mar05)
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 GEOMCACHEENTRY_H
16 #define GEOMCACHEENTRY_H
17 
18 #include "pandabase.h"
19 #include "geomCacheManager.h"
20 #include "referenceCount.h"
21 #include "config_gobj.h"
22 #include "pointerTo.h"
23 #include "mutexHolder.h"
24 
25 class Geom;
26 class GeomPrimitive;
27 
28 ////////////////////////////////////////////////////////////////////
29 // Class : GeomCacheEntry
30 // Description : This object contains a single cache entry in the
31 // GeomCacheManager. This is actually the base class of
32 // any number of individual cache types.
33 ////////////////////////////////////////////////////////////////////
34 class EXPCL_PANDA_GOBJ GeomCacheEntry : public ReferenceCount {
35 public:
36  INLINE GeomCacheEntry();
37  virtual ~GeomCacheEntry();
38 
39  PT(GeomCacheEntry) record(Thread *current_thread);
40  void refresh(Thread *current_thread);
41  PT(GeomCacheEntry) erase();
42 
43  virtual void evict_callback();
44  virtual void output(ostream &out) const;
45 
46 private:
47  int _last_frame_used;
48 
49  INLINE void remove_from_list();
50  INLINE void insert_before(GeomCacheEntry *node);
51 
52 private:
53  GeomCacheEntry *_prev, *_next;
54 
55 public:
56  static TypeHandle get_class_type() {
57  return _type_handle;
58  }
59  static void init_type() {
60  ReferenceCount::init_type();
61  register_type(_type_handle, "GeomCacheEntry",
62  ReferenceCount::get_class_type());
63  }
64 
65 private:
66  static TypeHandle _type_handle;
67 
68  friend class GeomCacheManager;
69 };
70 
71 INLINE ostream &operator << (ostream &out, const GeomCacheEntry &entry);
72 
73 #include "geomCacheEntry.I"
74 
75 #endif
This is an abstract base class for a family of classes that represent the fundamental geometry primit...
Definition: geomPrimitive.h:63
This is used to keep track of, and limit the size of, the cache of munged vertices, which would otherwise be distributed through all of the GeomVertexData objects in the system.
A container for geometry primitives.
Definition: geom.h:58
A base class for all things that want to be reference-counted.
A thread; that is, a lightweight process.
Definition: thread.h:51
This object contains a single cache entry in the GeomCacheManager.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85