Panda3D

geomCacheEntry.h

00001 // Filename: geomCacheEntry.h
00002 // Created by:  drose (21Mar05)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #ifndef GEOMCACHEENTRY_H
00016 #define GEOMCACHEENTRY_H
00017 
00018 #include "pandabase.h"
00019 #include "geomCacheManager.h"
00020 #include "referenceCount.h"
00021 #include "config_gobj.h"
00022 #include "pointerTo.h"
00023 #include "mutexHolder.h"
00024 
00025 class Geom;
00026 class GeomPrimitive;
00027 
00028 ////////////////////////////////////////////////////////////////////
00029 //       Class : GeomCacheEntry
00030 // Description : This object contains a single cache entry in the
00031 //               GeomCacheManager.  This is actually the base class of
00032 //               any number of individual cache types.
00033 ////////////////////////////////////////////////////////////////////
00034 class EXPCL_PANDA_GOBJ GeomCacheEntry : public ReferenceCount {
00035 public:
00036   INLINE GeomCacheEntry();
00037   virtual ~GeomCacheEntry();
00038 
00039   PT(GeomCacheEntry) record(Thread *current_thread);
00040   void refresh(Thread *current_thread);
00041   PT(GeomCacheEntry) erase();
00042 
00043   virtual void evict_callback();
00044   virtual void output(ostream &out) const;
00045 
00046 private:
00047   int _last_frame_used;
00048 
00049   INLINE void remove_from_list();
00050   INLINE void insert_before(GeomCacheEntry *node);
00051 
00052 private:  
00053   GeomCacheEntry *_prev, *_next;
00054 
00055 public:
00056   static TypeHandle get_class_type() {
00057     return _type_handle;
00058   }
00059   static void init_type() {
00060     ReferenceCount::init_type();
00061     register_type(_type_handle, "GeomCacheEntry",
00062                   ReferenceCount::get_class_type());
00063   }
00064   
00065 private:
00066   static TypeHandle _type_handle;
00067 
00068   friend class GeomCacheManager;
00069 };
00070 
00071 INLINE ostream &operator << (ostream &out, const GeomCacheEntry &entry);
00072 
00073 #include "geomCacheEntry.I"
00074 
00075 #endif
 All Classes Functions Variables Enumerations