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 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
|
<?xml version="1.0"?>
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
<!ENTITY igraph "igraph">
]>
<section id="igraph-PMT">
<title>About template types</title>
<para>
Some of the container types listed in this section are defined for
many base types. This is similar to templates in C++ and generics in
Ada, but it is implemented via preprocessor macros since the C language
cannot handle it. Here is the list of template types and the all base
types they currently support:
<glosslist>
<glossentry><glossterm>vector</glossterm><glossdef><para>
Vector is currently defined for <type>igraph_real_t</type>,
<type>igraph_integer_t</type> (int), <type>char</type> (char),
<type>igraph_bool_t</type> (bool) and <type>igraph_complex_t</type>
(complex). The default is <type>igraph_real_t</type>.
</para></glossdef></glossentry>
<glossentry><glossterm>matrix</glossterm><glossdef><para>
Matrix is currently defined for <type>igraph_real_t</type>,
<type>igraph_integer_t</type> (int), <type>char</type> (char),
<type>igraph_bool_t</type> (bool) and <type>igraph_complex_t</type>
(complex). The default is <type>igraph_real_t</type>.
</para></glossdef></glossentry>
<glossentry><glossterm>array3</glossterm><glossdef><para>
Array3 is currently defined for <type>igraph_real_t</type>,
<type>igraph_integer_t</type> (int), <type>char</type> (char) and
<type>igraph_bool_t</type> (bool). The default is
<type>igraph_real_t</type>.
</para></glossdef></glossentry>
<glossentry><glossterm>stack</glossterm><glossdef><para>
Stack is currently defined for <type>igraph_real_t</type>,
<type>igraph_integer_t</type> (int), <type>char</type> (char),
<type>igraph_bool_t</type> (bool) and <type>void*</type> (ptr).
The default is <type>igraph_real_t</type>.
</para></glossdef></glossentry>
<glossentry><glossterm>double-ended queue</glossterm><glossdef><para>
Dqueue is currently defined for <type>igraph_real_t</type>,
<type>igraph_integer_t</type> (int), <type>char</type> (char) and
<type>igraph_bool_t</type> (bool). The default is
<type>igraph_real_t</type>.
</para></glossdef></glossentry>
<glossentry><glossterm>heap</glossterm><glossdef><para>
Heap is currently defined for <type>igraph_real_t</type>,
<type>igraph_integer_t</type> (int), <type>char</type> (char).
In addition both maximum and minimum heaps are available.
The default is the <type>igraph_real_t</type> maximum heap.
</para></glossdef></glossentry>
<glossentry><glossterm>list of vectors</glossterm><glossdef><para>
Lists of vectors are currently defined for vectors holding
<type>igraph_real_t</type> and <type>igraph_integer_t</type> (int).
The default is <type>igraph_real_t</type>.
</para></glossdef></glossentry>
<glossentry><glossterm>list of matrices</glossterm><glossdef><para>
Lists of matrices are currently defined for matrices holding
<type>igraph_real_t</type> only.
</para></glossdef></glossentry>
</glosslist>
</para>
<para>
The name of the base element (in parentheses) is added to the function
names, except for the default type.
</para>
<para>
Some examples:
<itemizedlist>
<listitem><para>
<type>igraph_vector_t</type> is a vector of
<type>igraph_real_t</type> elements. Its functions are
<function>igraph_vector_init</function>,
<function>igraph_vector_destroy</function>,
<function>igraph_vector_sort</function>, etc.
</para></listitem>
<listitem><para>
<type>igraph_vector_bool_t</type> is a vector of
<type>igraph_bool_t</type> elements; initialize it with
<function>igraph_vector_bool_init</function>, destroy it with
<function>igraph_vector_bool_destroy</function>, etc.
</para></listitem>
<listitem><para>
<type>igraph_heap_t</type> is a maximum heap with
<type>igraph_real_t</type> elements. The corresponding functions are
<function>igraph_heap_init</function>,
<function>igraph_heap_pop</function>, etc.
</para></listitem>
<listitem><para>
<type>igraph_heap_min_t</type> is a minimum heap with
<type>igraph_real_t</type> elements. The corresponding functions are
called <function>igraph_heap_min_init</function>,
<function>igraph_heap_min_pop</function>, etc.
</para></listitem>
<listitem><para>
<type>igraph_heap_int_t</type> is a maximum heap with <type>igraph_integer_t</type>
elements. Its functions have the <function>igraph_heap_int_</function> prefix.
</para></listitem>
<listitem><para>
<type>igraph_heap_min_int_t</type> is a minimum heap containing
<type>igraph_integer_t</type> elements. Its functions have the
<function>igraph_heap_min_int_</function> prefix.
</para></listitem>
<listitem><para>
<type>igraph_vector_list_t</type> is a list of (floating-point) vectors; each
element in this data structure is an <type>igraph_vector_t</type>.
Similarly, <type>igraph_matrix_list_t</type> is a list of (floating-point)
matrices; each element in this data structure is an <type>igraph_matrix_t</type>.
</para></listitem>
<listitem><para>
<type>igraph_vector_int_list_t</type> is a list of integer vectors; each
element in this data structure is an <type>igraph_vector_int_t</type>.
</para></listitem>
</itemizedlist>
</para>
<para>
Note that the <link linkend="VECTOR">VECTOR</link> and the <link
linkend="MATRIX">MATRIX</link> macros can be used on <emphasis>all</emphasis>
vector and matrix types. <link linkend="VECTOR">VECTOR</link> cannot be used
on <emphasis>lists</emphasis> of vectors, though, only on the individial
vectors in the list.
</para>
</section>
|