00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef _AFLIBMEMCACHE_H
00024 #define _AFLIBMEMCACHE_H
00025
00026
00027 #ifdef HAVE_CONFIG_H
00028 #include <config.h>
00029 #endif
00030
00055 class aflibData;
00056 class aflibMemNode;
00057
00058 #include <map>
00059 using std::map;
00060
00061 class aflibMemCache {
00062
00063 public:
00064
00065 aflibMemCache();
00066
00067 virtual
00068 ~aflibMemCache();
00069
00070 bool
00071 getCacheEnable();
00072
00073 void
00074 setCacheEnable(bool enable);
00075
00076 long long
00077 getCacheMax() const;
00078
00079 long long
00080 getCacheTotal() const;
00081
00082 long long
00083 getCacheLocal() const;
00084
00085 void
00086 clearCache();
00087
00088 protected:
00089
00090 void
00091 lookupData(
00092 long long& position,
00093 int& num_samples);
00094
00095 void
00096 fillDataFromCache(
00097 aflibData& data,
00098 long long& position,
00099 int& num_samples,
00100 long long orig_position,
00101 int orig_num_samples);
00102
00103 private:
00104
00105 aflibMemCache(aflibMemCache& op);
00106
00107 const aflibMemCache&
00108 operator=(const aflibMemCache& op);
00109
00110 void
00111 calcPosition(
00112 long long& position,
00113 int& num_samples,
00114 map< long long, aflibMemNode* >::iterator it);
00115
00116 void
00117 reduceCache();
00118
00119 bool
00120 checkExistingNode(
00121 long long position,
00122 aflibData& data);
00123
00124 void
00125 createNewNode(
00126 int start_element,
00127 int stop_element,
00128 long long position,
00129 aflibData& data);
00130
00131 void
00132 cacheData(
00133 long long position,
00134 aflibData& data);
00135
00136 long long _cache_counter;
00137 long long _cache_size_max;
00138 static long long _cache_size_total;
00139 long long _cache_size_local;
00140 bool _enable;
00141 map< long long, aflibMemNode* > _node_array;
00142
00143
00144 };
00145
00146 #endif
00147
00148