Panda3D
geomCacheEntry.h
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 geomCacheEntry.h
10  * @author drose
11  * @date 2005-03-21
12  */
13 
14 #ifndef GEOMCACHEENTRY_H
15 #define GEOMCACHEENTRY_H
16 
17 #include "pandabase.h"
18 #include "geomCacheManager.h"
19 #include "referenceCount.h"
20 #include "config_gobj.h"
21 #include "pointerTo.h"
22 #include "mutexHolder.h"
23 
24 class Geom;
25 class GeomPrimitive;
26 
27 /**
28  * This object contains a single cache entry in the GeomCacheManager. This is
29  * actually the base class of any number of individual cache types.
30  */
31 class EXPCL_PANDA_GOBJ GeomCacheEntry : public ReferenceCount {
32 public:
33  INLINE GeomCacheEntry();
34  virtual ~GeomCacheEntry();
35 
36  PT(GeomCacheEntry) record(Thread *current_thread);
37  void refresh(Thread *current_thread);
38  PT(GeomCacheEntry) erase();
39 
40  virtual void evict_callback();
41  virtual void output(std::ostream &out) const;
42 
43 private:
44  int _last_frame_used;
45 
46  INLINE void remove_from_list();
47  INLINE void insert_before(GeomCacheEntry *node);
48 
49 private:
50  GeomCacheEntry *_prev, *_next;
51 
52 public:
53  static TypeHandle get_class_type() {
54  return _type_handle;
55  }
56  static void init_type() {
57  ReferenceCount::init_type();
58  register_type(_type_handle, "GeomCacheEntry",
59  ReferenceCount::get_class_type());
60  }
61 
62 private:
63  static TypeHandle _type_handle;
64 
65  friend class GeomCacheManager;
66 };
67 
68 INLINE std::ostream &operator << (std::ostream &out, const GeomCacheEntry &entry);
69 
70 #include "geomCacheEntry.I"
71 
72 #endif
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition: register_type.I:22
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is an abstract base class for a family of classes that represent the fundamental geometry primit...
Definition: geomPrimitive.h:56
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is used to keep track of, and limit the size of, the cache of munged vertices,...
A container for geometry primitives.
Definition: geom.h:54
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A base class for all things that want to be reference-counted.
A thread; that is, a lightweight process.
Definition: thread.h:46
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This object contains a single cache entry in the GeomCacheManager.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81