p2  0.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PNTable Class Reference

the table class, based on khash More...

#include <table.h>

Public Member Functions

PN potion_table_string (Potion *P, PN cl, PN self)
 
PN potion_table_empty (Potion *P)
 
PN potion_table_at (Potion *P, PN cl, PN self, PN key)
 
PN potion_table_each (Potion *P, PN cl, PN self, PN block)
 
PN potion_table_put (Potion *P, PN cl, PN self, PN key, PN value)
 
PN potion_table_remove (Potion *P, PN cl, PN self, PN key)
 
PN potion_table_length (Potion *P, PN cl, PN self)
 
static PN potion_table_slice (Potion *P, PN cl, PN self, PN keys)
 
static PN potion_table_keys (Potion *P, PN cl, PN self)
 
static PN potion_table_values (Potion *P, PN cl, PN self)
 

Data Fields

 PN_OBJECT_HEADER
 PNType vt; PNUniq uniq. More...
 
 PN_TABLE_HEADER
 PN_SIZE n_buckets, size, n_occupied, upper_bound. More...
 
char table []
 

Detailed Description

the table class, based on khash

hash, the central table type, based on khash

Definition at line 40 of file table.h.

Member Function Documentation

PN potion_table_string ( Potion P,
PN  cl,
PN  self 
)

"string" method

Returns
PNString

Definition at line 23 of file table.c.

PN potion_table_empty ( Potion P)

"empty" method

Returns
PNTable

Definition at line 42 of file table.c.

PN potion_table_at ( Potion P,
PN  cl,
PN  self,
PN  key 
)

"at" method

Parameters
keyPN
Returns
PN value or PN_NIL

Definition at line 70 of file table.c.

PN potion_table_each ( Potion P,
PN  cl,
PN  self,
PN  block 
)

"each" method. call block on each member (hash order)

Parameters
blockPNClosure
Returns
self PNTable

Definition at line 82 of file table.c.

PN potion_table_put ( Potion P,
PN  cl,
PN  self,
PN  key,
PN  value 
)

"put" method. write to the hash

Parameters
keyPN
valuePN
Returns
self PNTable

Definition at line 98 of file table.c.

PN potion_table_remove ( Potion P,
PN  cl,
PN  self,
PN  key 
)

"remove" method. remove key from hash

Parameters
keyPN
Returns
self PNTable

Definition at line 113 of file table.c.

PN potion_table_length ( Potion P,
PN  cl,
PN  self 
)

"length" method. count keys

Returns
PNInteger

Definition at line 134 of file table.c.

static PN potion_table_slice ( Potion P,
PN  cl,
PN  self,
PN  keys 
)

Extract slice copy of a table with only the given keys. Not found keys are ignored.

t = (0="", 1="", 2="")
t slice #=> t
t slice((1,2,3)) #=> (1="", 2="")
t slice(()) #=> ()
Parameters
keysPNTuple.
Returns
new PNTable

Definition at line 169 of file table.c.

static PN potion_table_keys ( Potion P,
PN  cl,
PN  self 
)
(0="", 1="", 2="") keys => (0, 1, 2)
Returns
new PNTuple

Definition at line 200 of file table.c.

static PN potion_table_values ( Potion P,
PN  cl,
PN  self 
)
(0="",1="",2="") keys => ("","","")
Returns
new PNTuple

Definition at line 219 of file table.c.

Field Documentation

PNTable::PN_OBJECT_HEADER

PNType vt; PNUniq uniq.

Definition at line 41 of file table.h.

PNTable::PN_TABLE_HEADER

PN_SIZE n_buckets, size, n_occupied, upper_bound.

Definition at line 42 of file table.h.

char PNTable::table[]

Definition at line 43 of file table.h.


The documentation for this class was generated from the following files: