2018-02-13 11:37:54 +08:00
|
|
|
/*=======================================================================
|
|
|
|
* File name: IVEntry.h
|
|
|
|
* Author: Zongyue Qin
|
|
|
|
* Mail: qinzongyue@pku.edu.cn
|
|
|
|
* Last Modified: 2018-01-30
|
|
|
|
* Description: head file of IVEntry, the most basic unit of IVArray
|
|
|
|
* =====================================================================*/
|
|
|
|
|
|
|
|
#include "../../Util/Util.h"
|
|
|
|
#include "../../Util/VList.h"
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
class IVEntry
|
|
|
|
{
|
|
|
|
bool usedFlag; // mark if the entry is used
|
|
|
|
bool dirtyFlag;
|
|
|
|
bool cacheFlag;
|
|
|
|
unsigned store; //index of block where value is stored
|
2018-02-27 15:32:20 +08:00
|
|
|
// pointer to id for LRU list
|
|
|
|
int prevID;
|
|
|
|
int nextID;
|
|
|
|
|
2018-02-13 11:37:54 +08:00
|
|
|
Bstr* value;
|
2018-02-27 15:32:20 +08:00
|
|
|
|
2018-02-13 11:37:54 +08:00
|
|
|
public:
|
|
|
|
IVEntry();
|
|
|
|
|
|
|
|
void setBstr(const Bstr* _value);
|
2018-02-27 15:32:20 +08:00
|
|
|
bool getBstr(char *& _str, unsigned& _len, bool if_copy = true) const;
|
2018-02-13 11:37:54 +08:00
|
|
|
void setBstr(const char *_str, unsigned _len);
|
|
|
|
|
|
|
|
void setStore(unsigned _store);
|
|
|
|
unsigned getStore() const;
|
|
|
|
|
|
|
|
void setUsedFlag(bool _flag);
|
|
|
|
bool isUsed() const;
|
|
|
|
|
|
|
|
void setDirtyFlag(bool _flag);
|
|
|
|
bool isDirty() const;
|
|
|
|
|
|
|
|
void setCacheFlag(bool _flag);
|
|
|
|
bool inCache() const;
|
|
|
|
|
|
|
|
void release();
|
|
|
|
|
|
|
|
void Copy(const IVEntry& _entry);
|
|
|
|
|
2018-02-27 15:32:20 +08:00
|
|
|
void setPrev(int ID);
|
|
|
|
int getPrev() const;
|
|
|
|
void setNext(int ID);
|
|
|
|
int getNext() const;
|
|
|
|
|
2018-02-13 11:37:54 +08:00
|
|
|
~IVEntry();
|
|
|
|
};
|