QuickHashStringIntHash::loadFromFile
This factory method creates a hash from a file
&reftitle.description;
public static QuickHashStringIntHashQuickHashStringIntHash::loadFromFile
stringfilename
intsize0
intoptions0
This factory method creates a new hash from a definition file on disk. The
file format consists of a signature 'QH\0x21\0', the number of elements as
a 32 bit signed integer in system Endianness, an unsigned 32 bit integer
containing the number of element data to follow in characters. This element
data contains all the strings. The follows another signed 32 bit integer
containing the number of bucket lists. After the header and the strings,
the elements follow. They are ordered by bucket list so that the keys don't
have to be hashed in order to restore the hash. For each bucket list, the
following information is stored (all as 32 bit integers): the bucket list
index, the number of elements in that list, and then in pairs of two
unsigned 32 bit integers the elements, where the first one is the index
into the string list containing the keys, and the second one the value. An
example could be:
QuickHash StringIntHash file format
QuickHash IntHash file format
&reftitle.parameters;
filename
The filename of the file to read the hash from.
size
The amount of bucket lists to configure. The number you pass in will be
automatically rounded up to the next power of two. It is also
automatically limited from 4 to 4194304.
options
The same options that the class' constructor takes; except that the size
option is ignored. It is read from the file format (unlike the
QuickHashIntHash and QuickHashIntStringHash classes, where it is
automatically calculated from the number of entries in the hash.)
&reftitle.returnvalues;
Returns a new QuickHashStringIntHash.
&reftitle.examples;
QuickHashStringIntHash::loadFromFile example
', $hash->get( $k ), "\n";
}
?>
]]>
&example.outputs.similar;
48712
12uf => 50343
143q => 51974
15d1 => 53605
16mc => 55236
17vn => 56867
194y => 58498
1ae9 => 60129
1bnk => 61760
1cwv => 63391
1e66 => 65022
1ffh => 66653
1gos => 68284
1hy3 => 69915
1j7e => 71546
1kgp => 73177
]]>