Create ClassForVlistCache.h

Add class KEY_SIZE_VALUE, used in database.cpp to find important subIDs and objIDs.
Add class Longlist_inMem, used in Vlist as cache
This commit is contained in:
ZongyueQin 2017-07-15 10:08:43 +08:00 committed by GitHub
parent 9ca106ca7e
commit 0cd6b75026
1 changed files with 33 additions and 0 deletions

33
Util/ClassForVlistCache.h Normal file
View File

@ -0,0 +1,33 @@
class KEY_SIZE_VALUE
{
public:
unsigned key, size, value;
KEY_SIZE_VALUE(unsigned _key = 0, unsigned _size = 0, unsigned _value = 0) : key(_key), size(_size), value(_value) {}
bool operator < (const KEY_SIZE_VALUE& b) const
{
return value > b.value;
}
bool operator > (const KEY_SIZE_VALUE& b) const
{
return value < b.value;
}
};
class Longlist_inMem
{
public:
int key;
unsigned _len;
char* _str;
Longlist_inMem()
{
key = -1;
_len = 0;
_str = NULL;
}
~Longlist_inMem()
{
if(_str != NULL) delete []_str;
}
};