[go: up one dir, main page]

File: TommyObj.h

package info (click to toggle)
combblas 2.0.0-6
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 190,476 kB
  • sloc: cpp: 55,912; ansic: 25,134; sh: 3,691; makefile: 548; csh: 66; python: 49; perl: 21
file content (38 lines) | stat: -rw-r--r-- 642 bytes parent folder | download | duplicates (2)
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