#include <emcache.h>
Collaboration diagram for EMAN::GlobalCache:
Public Member Functions | |
ImageIO * | get_imageio (const string &filename, int rw_mode) |
void | add_imageio (const string &filename, int rw_mode, ImageIO *io) |
Static Public Member Functions | |
GlobalCache * | instance () |
Private Member Functions | |
GlobalCache () | |
GlobalCache (const GlobalCache &gc) | |
~GlobalCache () | |
Private Attributes | |
EMCache< ImageIO > * | imageio_cache |
map< string, int > | file_rw_dict |
Static Private Attributes | |
GlobalCache * | global_cache = 0 |
It uses EMCache template in its internal implementation.
Definition at line 165 of file emcache.h.
|
Definition at line 52 of file emcache.cpp. References imageio_cache. Referenced by instance(). 00053 { 00054 imageio_cache = new EMCache < ImageIO > (8); 00055 }
|
|
Definition at line 57 of file emcache.cpp. 00058 { 00059 }
|
|
Definition at line 61 of file emcache.cpp. References imageio_cache. 00062 { 00063 if(imageio_cache) 00064 { 00065 delete imageio_cache; 00066 imageio_cache = 0; 00067 } 00068 }
|
|
Definition at line 110 of file emcache.cpp. References EMAN::EMCache< T >::add(), file_rw_dict, and imageio_cache. Referenced by EMAN::EMUtil::get_imageio(). 00111 { 00112 if (io) { 00113 file_rw_dict[filename] = rw_mode; 00114 imageio_cache->add(filename, io); 00115 } 00116 }
|
|
Definition at line 79 of file emcache.cpp. References file_rw_dict, EMAN::EMCache< T >::get(), imageio_cache, EMAN::Util::is_file_exist(), and EMAN::EMCache< T >::remove(). Referenced by EMAN::EMUtil::get_imageio(). 00080 { 00081 ImageIO *io = imageio_cache->get(filename); 00082 if (io) { 00083 bool need_remove = false; 00084 00085 int old_rw = file_rw_dict[filename]; 00086 00087 if (rw_mode == ImageIO::READ_ONLY) { 00088 if (old_rw == ImageIO::WRITE_ONLY) { 00089 need_remove = true; 00090 } 00091 } 00092 else if (rw_mode != old_rw) { 00093 need_remove = true; 00094 } 00095 else { 00096 if (!Util::is_file_exist(filename)) { 00097 need_remove = true; 00098 } 00099 } 00100 if (need_remove) { 00101 imageio_cache->remove(filename); 00102 io = 0; 00103 } 00104 } 00105 00106 return io; 00107 }
|
|
Definition at line 71 of file emcache.cpp. References global_cache, and GlobalCache(). Referenced by EMAN::EMUtil::get_imageio(). 00072 { 00073 if (!global_cache) { 00074 global_cache = new GlobalCache(); 00075 } 00076 return global_cache; 00077 }
|
|
Definition at line 176 of file emcache.h. Referenced by add_imageio(), and get_imageio(). |
|
Definition at line 50 of file emcache.cpp. Referenced by instance(). |
|
Definition at line 174 of file emcache.h. Referenced by add_imageio(), get_imageio(), GlobalCache(), and ~GlobalCache(). |