aboutsummaryrefslogtreecommitdiffstats
path: root/util/generic/hash.cpp
blob: bbc922072e19bebca0dd85c9dbea59f5d0a42c2b (plain) (blame)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
#include "hash.h"

#include <util/string/escape.h> 
#include <util/string/cast.h>

const void* const _yhashtable_empty_data[] = {(void*)3, nullptr, (void*)1};
 
TString NPrivate::MapKeyToString(TStringBuf key) {
    constexpr size_t HASH_KEY_MAX_LENGTH = 500; 
    try { 
        return EscapeC(key.substr(0, HASH_KEY_MAX_LENGTH)); 
    } catch (...) { 
        return "TStringBuf";
    } 
} 

TString NPrivate::MapKeyToString(unsigned short key) {
    return ToString(key);
}

TString NPrivate::MapKeyToString(short key) {
    return ToString(key);
}

TString NPrivate::MapKeyToString(unsigned int key) {
    return ToString(key);
}

TString NPrivate::MapKeyToString(int key) {
    return ToString(key);
}

TString NPrivate::MapKeyToString(unsigned long key) {
    return ToString(key);
}

TString NPrivate::MapKeyToString(long key) {
    return ToString(key);
}

TString NPrivate::MapKeyToString(unsigned long long key) {
    return ToString(key);
}

TString NPrivate::MapKeyToString(long long key) {
    return ToString(key);
}

void NPrivate::ThrowKeyNotFoundInHashTableException(const TStringBuf keyRepresentation) {
    ythrow yexception() << "Key not found in hashtable: " << keyRepresentation;
}