| parrotcode: Ordered Hash | |
| Contents | PMCs |

src/pmc/orderedhash.pmc - Ordered Hash

OrderedHash extends Hash to provide the interfaces of array and hash.
To achieve the functionality of an ordered hash there are a few restrictions though: delete_keyed never removes items,
they are just nulled.
Please note that if values are set via integer idx,
these indices have to be in strict order.
Using push_xx simplifies this task.
This creates a key "\1idx" for idx and is therefore not fully transparent.
There are 2 iterator interfaces:
Please note that after a delete_keyed operation,
iterating over values doesn't work any more,
you'll get an error 'No such key'.
See t/pmc/orderedhash.t.

PMC *get_pmc_keyed(PMC *key)PMC *get_pmc_keyed_int(INTVAL key)PMC *get_pmc_keyed_str(STRING *key)STRING *get_string_keyed(PMC *key)STRING *get_string_keyed_int(INTVAL key)STRING *get_string_keyed_str(STRING *key)INTVAL get_integer_keyed(PMC *key)INTVAL get_integer_keyed_str(STRING *key)INTVAL get_integer_keyed_int(INTVAL key)key.FLOATVAL get_number_keyed(PMC *key)FLOATVAL get_number_keyed_int(INTVAL key)FLOATVAL get_number_keyed_str(STRING *key)key.void set_pmc_keyed_int(INTVAL idx, PMC *val)void set_integer_keyed_int(INTVAL key, INTVAL value)void set_number_keyed_int(INTVAL key, FLOATVAL value)void set_string_keyed_int(INTVAL key, STRING *value)key to val.
The created key = "\1idx".void push_float(FLOATVAL value)void push_integer(INTVAL value)void push_pmc(PMC *value)void push_string(STRING *value)INTVAL exists_keyed(PMC *key)INTVAL exists_keyed_str(STRING *key)INTVAL exists_keyed_int(INTVAL key)INTVAL defined_keyed(PMC *key)INTVAL defined_keyed_str(STRING *key)INTVAL defined_keyed_int(INTVAL key)void delete_keyed(PMC *key)void delete_keyed_str(STRING *key)void delete_keyed_int(INTVAL key)*key from the hash.PMC *clone()void visit(visit_info *info)void freeze(visit_info *info)void thaw(visit_info *info)
docs/pdds/pdd08_keys.pod.

Initial rev by leo 2003-08-21.
|
|
|