1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
|
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
project.
Copyright (C) 1998-2018 OpenLink Software
This project is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; only version 2 of the License, dated June 1991.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
: template.sh,v 1.4 2006/04/17 22:58:08 ivan Exp $
-->
<refentry id="fn_dict_new">
<refmeta>
<refentrytitle>dict_new</refentrytitle>
<refmiscinfo>dict</refmiscinfo>
</refmeta>
<refnamediv>
<refname>dict_new</refname>
<refpurpose>Creates a new dictionary to store key-value pairs.</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis id="fsyn_dict_new">
<funcprototype id="fproto_dict_new">
<funcdef>dictionary <function>dict_new</function></funcdef>
<paramdef><optional>in <parameter>size</parameter> integer</optional></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1 id="desc_dict_new">
<title>Description</title>
<para>This function creates a new dictionary. A dictionary is a memory-resident hash table that can store an arbitrary number of key-value pairs.
Both key and dependent part can be of any type, including vectors. Two keys of different data types are always considered as different even if
SQL '=' operator return 'true', e.g. integer zero and double precision 0.0 are two different keys.
Vectors are equivalent if their corresponding members are either equal scalars or equivalent vectors.
XML entities are equivalent if they refer to the same node or attribute in the same document.
</para>
<para>Dictionary objects are always passed by reference, even if dictionary is passed as an 'in' argument of a function.
If value of a variable is a dictionary and it is assigned to other variable then both variables refer to the same internal hashtable.
To create two really independent dictionary objects, use <para><link linkend="fn_dict_duplicate"><function>dict_duplicate ()</function></link>.</para>
</para>
</refsect1>
<refsect1 id="params_dict_new">
<title>Parameters</title>
<refsect2><title>size</title>
<para>The guessed side of hashtable.
overestimation of the size will result in needless memory consumption whereas underscore leads to a bit slower insertion,
because the internal hash table will grow dynamically.
The simplest approach is to omit the parameter at all if you don't know the number of keys to be stored.</para>
</refsect2>
</refsect1>
<refsect1 id="ret_dict_new"><title>Return Types</title>
<para>The function returns a new empty dictionary object.</para>
</refsect1>
<!--
<refsect1 id="examples_dict_new">
<title>Examples</title>
<example id="ex_dict_new"><title></title>
<para></para>
<screen><![CDATA[
]]>
</screen>
</example>
</refsect1> -->
<refsect1 id="seealso_dict_new">
<title>See Also</title>
<para><link linkend="fn_dict_zap"><function>dict_zap()</function></link></para>
<para><link linkend="fn_dict_put"><function>dict_put()</function></link></para>
<para><link linkend="fn_dict_get"><function>dict_get()</function></link></para>
<para><link linkend="fn_dict_remove"><function>dict_remove()</function></link></para>
<para><link linkend="fn_dict_inc_or_put"><function>dict_inc_or_put()</function></link></para>
<para><link linkend="fn_dict_dec_or_remove"><function>dict_dec_or_remove()</function></link></para>
<para><link linkend="fn_dict_size"><function>dict_size()</function></link></para>
<para><link linkend="fn_dict_duplicate"><function>dict_duplicate()</function></link></para>
<para><link linkend="fn_dict_to_vector"><function>dict_to_vector()</function></link></para>
<para><link linkend="fn_dict_list_keys"><function>dict_list_keys()</function></link></para>
<para><link linkend="fn_dict_destructive_list_rnd_keys"><function>dict_destructive_list_rnd_keys()</function></link></para>
<para><link linkend="fn_dict_iter_rewind"><function>dict_iter_rewind()</function></link></para>
<para><link linkend="fn_dict_iter_next"><function>dict_iter_next()</function></link></para>
</refsect1>
</refentry>
|