GLib: multi-dimensional GHashTables
- From: Charles Randall <crandall matchlogic com>
- To: gtk-list redhat com
- Subject: GLib: multi-dimensional GHashTables
- Date: Fri, 23 Jul 1999 14:39:52 -0600
I'd like to get some feeback on a proof-of-concept implementation of
multi-dimensional GHashTables. These are like the hashes of hashes described
in Perl's Data Structures Cookbook man page (man perldsc).
I've attached a sample program with proof-of-concept versions of
g_md_hash_table_insert() and g_md_hash_table_lookup().
These allow the programmer to pass in a "base" hash and a set of keys and
insert or lookup an associated value. All keys are assumed to be of the same
data type (in this example, they're all strings).
In Perl's syntax, this is just like
$hash{"dog"}{"lassie"}{"color"} = "gold";
$value = $hash{"dog"}{"lassie"}{"color"};
Given this, you can implement a fairly sophisticated data storage mechanism.
Has anyone else looked at or wanted something like this?
Charles
<<md_hash.c>>
md_hash.c
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]