NAME

src/pmc/orderedhash.pmc - Ordered Hash

DESCRIPTION

OrderedHash provide the interfaces of array and hash.

Some limitations:

To archive ordering for each item we store:

OrderedHash stores next things:

See t/pmc/orderedhash.t for test cases.

Overall design heavily inspired by Tie::StoredOrderHash.

Methods

void init()
Create new instance of OrderedHash.
void mark()
Marks the OrderedHash as live.
PMC *get_iter()
Return a new iterator
INTVAL elements()
INTVAL get_integer()
FLOATVAL get_number()
Returns the size of the hash.
set_pmc_keyed(PMC *key, PMC *value)
Main set function.
void set_integer_keyed(INTVAL key, INTVAL value)
void set_number_keyed(INTVAL key, FLOATVAL value)
void set_string_keyed(INTVAL key, STRING *value)
Sets the PMC value of the element at index key to val.
void set_pmc_keyed_str(STRING *key, PMC *val)
void set_integer_keyed_str(STRING *key, INTVAL value)
void set_number_keyed_str(STRING *key, FLOATVAL value)
void set_string_keyed_str(STRING *key, STRING *value)
Sets the PMC value of the element at index key to val.
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)
Returns the integer value associated with key.
FLOATVAL get_number_keyed(PMC *key)
FLOATVAL get_number_keyed_int(INTVAL key)
FLOATVAL get_number_keyed_str(STRING *key)
Returns the floating-point value for the element at 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)
Sets the PMC value of the element at index 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)
Deletes the key *key from the hash.
PMC *clone()
Create a clone of the OrderedHash. Non-existent keys are compacted. Accessing the clone via integers has different indices, if items were deleted.
void visit(PMC *info)
Used during archiving to visit the elements in the hash.
void freeze(PMC *info)
Used to archive the hash.
void thaw(PMC *info)
Used to unarchive the hash.
get_pmc()
Get underlying regular Hash. Used in UnManagedStruct.

SEE ALSO

docs/pdds/pdd08_keys.pod.

HISTORY

Initial rev by leo 2003-08-21.