Speed up method lookup. Replaced tagging/detagging macros with
[panda.git] / src / st-association.h
blobb90c4068f6e41e4666994ed3dc2e40de76bd564e
1 /*
2 * st-association.h
4 * Copyright (c) 2008 Vincent Geddes
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 * THE SOFTWARE.
25 #ifndef __ST_ASSOCIATION_H__
26 #define __ST_ASSOCIATION_H__
28 #include <st-object.h>
29 #include <st-types.h>
31 struct st_association
33 struct st_header header;
35 st_oop key;
36 st_oop value;
39 st_oop st_association_new (st_oop key, st_oop value);
40 st_uint st_association_hash (st_oop object);
41 bool st_association_equal (st_oop object, st_oop other);
43 #define ST_ASSOCIATION(oop) ((struct st_association *) st_detag_pointer (oop))
44 #define ST_ASSOCIATION_KEY(oop) (ST_ASSOCIATION(oop)->key)
45 #define ST_ASSOCIATION_VALUE(oop) (ST_ASSOCIATION(oop)->value)
47 #endif /* __ST_ASSOCIATION_H__ */