00001 #ifndef _JOT_DLHANDLER_DLHANDLER_H 00002 #define _JOT_DLHANDLER_DLHANDLER_H 00003 #include "std/support.H" 00004 #include "disp/view.H" 00005 #include "std/thread_mutex.H" 00006 00007 // 00008 // Keep track of display list and whether it is valid 00009 // 00010 // 00011 // Issues: 00012 // Multi thread option 1 - display list per view 00013 // 1 DLhandler per view? - store hash table of view -> _dl/_dl_stamp 00014 // Multi-thread option 2 - share display lists, need synchronization 00015 // Need close_dl call (for synchronization) 00016 // need to sync 00017 // 00018 class DLhandler { 00019 public: 00020 DLhandler(); 00021 virtual ~DLhandler() { delete_all_dl(); } 00022 00023 int dl (CVIEWptr &v) const; 00024 bool valid(CVIEWptr &v, int cmp_stamp = -1) const; 00025 00026 // Invalidate display list 00027 void invalidate(); 00028 // Delete display list 00029 void delete_dl(CVIEWptr &v); 00030 void delete_all_dl(); 00031 00032 // Get a display list, creating one if necessary 00033 int get_dl (CVIEWptr &v, int num_dls=1, int set_stamp = 1); 00034 // Close display list 00035 void close_dl(CVIEWptr &v); 00036 00037 protected: 00038 ARRAY<int> _dl_array; 00039 ARRAY<int> _dl_stamp_array; 00040 void make_dl_big_enough(int i); 00041 void make_dl_stamp_big_enough(int i); 00042 ThreadMutex _dl_stamp_mutex; 00043 ThreadMutex _dl_mutex; 00044 }; 00045 #endif