potion  0.2
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
table.h
Go to the documentation of this file.
1 //
4 // (c) 2008 why the lucky stiff, the freelance professor
5 //
6 #ifndef POTION_TABLE_H
7 #define POTION_TABLE_H
8 
9 #include "potion.h"
10 #include "internal.h"
11 #include "khash.h"
12 
13 #ifndef MAX_INS_SORT
14 # define MAX_INS_SORT 10
15 #endif
16 
17 typedef PN (*PN_MCACHE_FUNC)(unsigned int hash);
18 // TODO: ensure the random PNUniq is truly unique for strings
19 typedef PN (*PN_IVAR_FUNC)(PNUniq hash);
20 
24 struct PNVtable {
28  PN name;
29  int ivlen;
31  vPN(Table) methods;
32  vPN(Vtable) meta;
33  PN ctor;
37 };
38 
40 struct PNTable {
43  char table[];
44 };
45 
47 KHASH_MAP_INIT_STR(str, struct PNTable)
48 
49 #endif
klib hash table library based on double hashing http://en.wikipedia.org/wiki/Double_hashing ...
PN_OBJECT_HEADER
PNType vt; PNUniq uniq.
Definition: table.h:25
PN callset
Definition: table.h:34
the central vtable, see io http://www.piumarta.com/pepsi/objmodel.pdf
Definition: table.h:24
unsigned int PNUniq
Definition: potion.h:79
unsigned int PNType
Definition: potion.h:79
vPN(Table) methods
methods hash, PNTable: name => closures
PN name
classes/types need to be found by name.
Definition: table.h:28
PN ctor
meta PNVtable
Definition: table.h:33
PN_TABLE_HEADER
PN_SIZE n_buckets, size, n_occupied, upper_bound.
Definition: table.h:42
the table class, based on khash
Definition: table.h:40
PN_IVAR_FUNC ivfunc
Definition: table.h:36
PN_MCACHE_FUNC mcache
(yet unused) method cache
Definition: table.h:35
PNType parent
parent type, default: for P->lobby: PN_VTABLE(PN_TOBJECT)
Definition: table.h:26
non-API internal parts
PN(* PN_IVAR_FUNC)(PNUniq hash)
Definition: table.h:19
PN(* PN_MCACHE_FUNC)(unsigned int hash)
Definition: table.h:17
PN_OBJECT_HEADER
PNType vt; PNUniq uniq.
Definition: table.h:41
The potion API.
PNType type
current type
Definition: table.h:27
#define KHASH_MAP_INIT_STR(name, t)
Definition: khash.h:234
PN call
Definition: table.h:34
int ivlen
PN_TUPLE_LEN(ivars)
Definition: table.h:29
volatile _PN PN
Definition: potion.h:81
PN ivars
PNTuple of all our or the parents inherited vars.
Definition: table.h:30
#define KHASH_MAP_INIT_PN(name, t)
Definition: khash.h:238