1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
#ifndef _TOMMY_OBJ_H_
#define _TOMMY_OBJ_H_
#include "compress_string.h"
#include "Tommy/tommyhashdyn.h"
using namespace std;
struct tommy_object {
tommy_node node;
uint32_t vid;
string vname;
tommy_object(uint32_t val, string name):vid(val)
{
#ifdef COMPRESS_STRING
vname = compress_string(name);
#else
vname = name;
#endif
}; // constructor
string getIndex() const
{
#ifdef COMPRESS_STRING
return decompress_string(vname);
#else
return vname;
#endif
}
};
int compare(const void* arg, const void* obj)
{
return *(const string*)arg != ((const tommy_object *)obj)->getIndex();
}
#endif
|