6#ifndef EVTSTRINGHASH_HH
7#define EVTSTRINGHASH_HH
17 inline void add(
const std::string& str,T*
data);
18 inline T*
get(
const std::string& str);
24 inline int hash(
const std::string& str);
25 std::string*** _strings;
37 typedef std::string** EvtStringPtrPtr;
40 _strings=
new EvtStringPtrPtr[_size];
41 _data=
new TPtrPtr[_size];
42 _entries=
new int[_size];
58 for(j=0;j<_entries[i];j++){
59 delete _strings[i][j];
62 delete [] _strings[i];
78 typedef std::string* EvtStringPtr;
81 std::string** newstrings=
new EvtStringPtr[_entries[ihash]+1];
82 T** newdata=
new TPtr[_entries[ihash]+1];
86 for(i=0;i<_entries[ihash];i++){
87 newstrings[i]=_strings[ihash][i];
88 newdata[i]=_data[ihash][i];
91 newstrings[_entries[ihash]]=
new std::string;
92 *(newstrings[_entries[ihash]])=str;
93 newdata[_entries[ihash]]=
data;
96 if(_entries[ihash]!=0){
97 delete [] _strings[ihash];
98 delete [] _data[ihash];
103 _strings[ihash]=newstrings;
104 _data[ihash]=newdata;
115 for (i=0;i<_entries[ihash];i++){
116 if (*(_strings[ihash][i])==str)
return _data[ihash][i];
128 const char* cstr=str.c_str();
void add(const std::string &str, T *data)
T * get(const std::string &str)