classes/orderedhash.pmc - Ordered Hash


OrderedHash extends PerlArray to provide the functionality of PerlArray (list in data) and a Hash (hash in struct_val). The list holds the PMC values, the hash keys point to the index of the value in the list.

There are 2 iterator interfaces:

See t/pmc/ordereredhash.t.

If values are set by numeric index only, there is no hash key. Iterating over the hash doesn't show these values.

Methods ^

static PMC *undef(Interp *interpreter)

Returns the PerlUndef PMC.

void init()

Initializes the ordered hash.

void mark()

Marks the ordered hash as live.

PMC *clone()

Creates and returns a clone of the ordered hash.

PMC *get_pmc_keyed(PMC *key)

PMC *get_pmc_keyed_str(STRING *key)

Returns the PMC value associated with *key.

INTVAL get_integer_keyed_str(STRING *key)

INTVAL get_integer_keyed(PMC *key)

Returns the integer value associated with *key.

FLOATVAL get_number_keyed(PMC *key)

Returns the floating-point value for the element at *key.

void set_pmc_keyed(PMC *key, PMC *value)

Associates *value with *key.

void set_integer_keyed(PMC *key, INTVAL value)

Associates value with *key.

void set_string_keyed(PMC *key, STRING *value)

Associates value with *key.

void set_pmc_keyed_str(STRING *key, PMC *value)

Associates *value with *key.

void set_integer_keyed_str(STRING *key, INTVAL value)

Associates value with *key.

void set_number_keyed (PMC *key, FLOATVAL value)

void set_string_keyed_str(STRING *key, STRING *value)

INTVAL exists_keyed(PMC *key)

INTVAL exists_keyed_str(STRING *key)

Returns whether the key *key exists in the hash.

INTVAL defined_keyed(PMC *key)

INTVAL defined_keyed_str(STRING *key)

Returns whether the value for key *key is defined in the hash.

void delete_keyed(PMC *key)

void delete_keyed_str(STRING *key)

Deletes the key *key from the hash.

STRING *get_string_keyed(PMC *key)

Returns the Parrot string associated with *key.




Initial rev by leo 2003-08-21.