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
00050 class aflibData;
00051 class aflibMemNode;
00052
00053 #include <map>
00054
00055
00056 class aflibMemCache {
00057
00058 public:
00059
00060 aflibMemCache();
00061
00062 virtual
00063 ~aflibMemCache();
00064
00065 bool
00066 getCacheEnable();
00067
00068 void
00069 setCacheEnable(bool enable);
00070
00071 long long
00072 getCacheMax() const;
00073
00074 long long
00075 getCacheTotal() const;
00076
00077 long long
00078 getCacheLocal() const;
00079
00080 void
00081 clearCache();
00082
00083 protected:
00084
00085 void
00086 lookupData(
00087 long long& position,
00088 int& num_samples);
00089
00090 void
00091 fillDataFromCache(
00092 aflibData& data,
00093 long long& position,
00094 int& num_samples,
00095 long long orig_position,
00096 int orig_num_samples);
00097
00098 private:
00099
00100 aflibMemCache(aflibMemCache& op);
00101
00102 const aflibMemCache&
00103 operator=(const aflibMemCache& op);
00104
00105 void
00106 calcPosition(
00107 long long& position,
00108 int& num_samples,
00109 map< long long, aflibMemNode* >::iterator it);
00110
00111 void
00112 reduceCache();
00113
00114 bool
00115 checkExistingNode(
00116 long long position,
00117 aflibData& data);
00118
00119 void
00120 createNewNode(
00121 int start_element,
00122 int stop_element,
00123 long long position,
00124 aflibData& data);
00125
00126 void
00127 cacheData(
00128 long long position,
00129 aflibData& data);
00130
00131 long long _cache_counter;
00132 long long _cache_size_max;
00133 static long long _cache_size_total;
00134 long long _cache_size_local;
00135 bool _enable;
00136 map< long long, aflibMemNode* > _node_array;
00137
00138
00139 };
00140
00141 #endif
00142
00143