/
compact_lookup_table.hpp
62 lines (44 loc) · 1.52 KB
/
compact_lookup_table.hpp
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
52
53
54
55
56
57
58
59
60
61
62
#ifndef RBX_BUILTIN_COMPACTLOOKUPTABLE_HPP
#define RBX_BUILTIN_COMPACTLOOKUPTABLE_HPP
#include "builtin/object.hpp"
#include "builtin/tuple.hpp"
#include "type_info.hpp"
namespace rubinius {
class Array;
class LookupTable;
// This value must be 2n
#define COMPACTLOOKUPTABLE_SIZE 12U
class CompactLookupTable : public Tuple {
public:
const static object_type type = CompactLookupTableType;
static void init(STATE);
// Rubinius.primitive :compactlookuptable_allocate
static CompactLookupTable* create(STATE);
// Rubinius.primitive :compactlookuptable_fetch
Object* fetch(STATE, Object* key);
Object* fetch(STATE, Object* key, bool* found);
Object* remove(STATE, Object* key, bool* removed = 0);
// Rubinius.primitive :compactlookuptable_remove
Object* remove_prim(STATE, Object* key) {
return remove(state, key);
}
// Rubinius.primitive :compactlookuptable_store
Object* store(STATE, Object* key, Object* val);
// Rubinius.primitive :compactlookuptable_has_key
Object* has_key(STATE, Object* key);
// Rubinius.primitive :compactlookuptable_keys
Array* keys(STATE);
Array* filtered_keys(STATE, ObjectMatcher& matcher, Array* ary=0);
// Rubinius.primitive :compactlookuptable_values
Array* values(STATE);
LookupTable* to_lookuptable(STATE);
class Info : public Tuple::Info {
public:
Info(object_type type)
: Tuple::Info(type)
{}
virtual void show(STATE, Object* self, int level);
};
};
};
#endif