<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>GObject_introspection__Union_info (gobject-introspection.GObject_introspection__Union_info)</title><link rel="stylesheet" href="../odoc.css"/><meta charset="utf-8"/><meta name="generator" content="odoc %%VERSION%%"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div class="content"><header><nav><a href="../index.html">Up</a> – <a href="../index.html">gobject-introspection</a> &#x00BB; GObject_introspection__Union_info</nav><h1>Module <code>GObject_introspection__Union_info</code></h1><p>Union_info — Module representing a C structure</p></header><dl><dt class="spec type" id="type-t"><a href="#type-t" class="anchor"></a><code><span class="keyword">type</span> t</code></dt><dd><p>Union_info represents a union type. A union has methods and fields. Unions can optionally have a discriminator, which is a field deciding what type of real union fields is valid for specified instance.</p></dd></dl><dl><dt class="spec value" id="val-unioninfo"><a href="#val-unioninfo" class="anchor"></a><code><span class="keyword">val</span> unioninfo : <span><span><a href="index.html#type-t">t</a> Ctypes.structure</span> Ctypes.typ</span></code></dt><dt class="spec value" id="val-get_n_fields"><a href="#val-get_n_fields" class="anchor"></a><code><span class="keyword">val</span> get_n_fields : <span><span><a href="index.html#type-t">t</a> Ctypes.structure</span> Ctypes.ptr</span> <span>&#45;&gt;</span> int</code></dt><dd><p>Obtain the number of fields this union has.</p></dd></dl><dl><dt class="spec value" id="val-get_size"><a href="#val-get_size" class="anchor"></a><code><span class="keyword">val</span> get_size : <span><span><a href="index.html#type-t">t</a> Ctypes.structure</span> Ctypes.ptr</span> <span>&#45;&gt;</span> int</code></dt><dd><p>Obtain the total size of the union.</p></dd></dl><dl><dt class="spec value" id="val-get_alignment"><a href="#val-get_alignment" class="anchor"></a><code><span class="keyword">val</span> get_alignment : <span><span><a href="index.html#type-t">t</a> Ctypes.structure</span> Ctypes.ptr</span> <span>&#45;&gt;</span> int</code></dt><dd><p>Obtain the required alignment of the union.</p></dd></dl><dl><dt class="spec value" id="val-get_n_methods"><a href="#val-get_n_methods" class="anchor"></a><code><span class="keyword">val</span> get_n_methods : <span><span><a href="index.html#type-t">t</a> Ctypes.structure</span> Ctypes.ptr</span> <span>&#45;&gt;</span> int</code></dt><dd><p>Obtain the number of methods this union has.</p></dd></dl><dl><dt class="spec value" id="val-get_field"><a href="#val-get_field" class="anchor"></a><code><span class="keyword">val</span> get_field : <span><span><a href="index.html#type-t">t</a> Ctypes.structure</span> Ctypes.ptr</span> <span>&#45;&gt;</span> int <span>&#45;&gt;</span> <span><span><a href="../GObject_introspection/Field_info/index.html#type-t">GObject_introspection.Field_info.t</a> Ctypes.structure</span> Ctypes.ptr</span></code></dt><dd><p>Obtain the type information for field with specified index.</p></dd></dl><dl><dt class="spec value" id="val-get_method"><a href="#val-get_method" class="anchor"></a><code><span class="keyword">val</span> get_method : <span><span><a href="index.html#type-t">t</a> Ctypes.structure</span> Ctypes.ptr</span> <span>&#45;&gt;</span> int <span>&#45;&gt;</span> <span><span><a href="../GObject_introspection/Function_info/index.html#type-t">GObject_introspection.Function_info.t</a> Ctypes.structure</span> Ctypes.ptr</span></code></dt><dd><p>Obtain the type information for method with specified index.</p></dd></dl><dl><dt class="spec value" id="val-find_method"><a href="#val-find_method" class="anchor"></a><code><span class="keyword">val</span> find_method : <span><span><a href="index.html#type-t">t</a> Ctypes.structure</span> Ctypes.ptr</span> <span>&#45;&gt;</span> string <span>&#45;&gt;</span> <span><span><span><a href="../GObject_introspection/Function_info/index.html#type-t">GObject_introspection.Function_info.t</a> Ctypes.structure</span> Ctypes.ptr</span> option</span></code></dt><dd><p>Obtain the type information for method named name .</p></dd></dl><dl><dt class="spec value" id="val-is_discriminated"><a href="#val-is_discriminated" class="anchor"></a><code><span class="keyword">val</span> is_discriminated : <span><span><a href="index.html#type-t">t</a> Ctypes.structure</span> Ctypes.ptr</span> <span>&#45;&gt;</span> bool</code></dt><dd><p>Return true if this union contains discriminator field.</p></dd></dl><dl><dt class="spec value" id="val-get_discriminator_offset"><a href="#val-get_discriminator_offset" class="anchor"></a><code><span class="keyword">val</span> get_discriminator_offset : <span><span><a href="index.html#type-t">t</a> Ctypes.structure</span> Ctypes.ptr</span> <span>&#45;&gt;</span> int</code></dt><dd><p>Returns offset of the discriminator field in the structure.</p></dd></dl><dl><dt class="spec value" id="val-get_discriminator_type"><a href="#val-get_discriminator_type" class="anchor"></a><code><span class="keyword">val</span> get_discriminator_type : <span><span><a href="index.html#type-t">t</a> Ctypes.structure</span> Ctypes.ptr</span> <span>&#45;&gt;</span> <span><span><a href="../GObject_introspection/Type_info/index.html#type-t">GObject_introspection.Type_info.t</a> Ctypes.structure</span> Ctypes.ptr</span></code></dt><dd><p>Obtain the type information of the union discriminator.</p></dd></dl><dl><dt class="spec value" id="val-get_discriminator"><a href="#val-get_discriminator" class="anchor"></a><code><span class="keyword">val</span> get_discriminator : <span><span><a href="index.html#type-t">t</a> Ctypes.structure</span> Ctypes.ptr</span> <span>&#45;&gt;</span> int <span>&#45;&gt;</span> <span><span><a href="../GObject_introspection/Constant_info/index.html#type-t">GObject_introspection.Constant_info.t</a> Ctypes.structure</span> Ctypes.ptr</span></code></dt><dd><p>Obtain discriminator value assigned for n-th union field, i.e. n-th union field is the active one if discriminator contains this constant.</p></dd></dl><dl><dt class="spec value" id="val-cast_from_baseinfo"><a href="#val-cast_from_baseinfo" class="anchor"></a><code><span class="keyword">val</span> cast_from_baseinfo : <span><span><a href="../GObject_introspection/Base_info/index.html#type-t">GObject_introspection.Base_info.t</a> Ctypes.structure</span> Ctypes.ptr</span> <span>&#45;&gt;</span> <span><span><a href="index.html#type-t">t</a> Ctypes.structure</span> Ctypes.ptr</span></code></dt><dd><p>Just cast OCaml Ctypes base info to union info.</p></dd></dl><dl><dt class="spec value" id="val-cast_to_baseinfo"><a href="#val-cast_to_baseinfo" class="anchor"></a><code><span class="keyword">val</span> cast_to_baseinfo : <span><span><a href="index.html#type-t">t</a> Ctypes.structure</span> Ctypes.ptr</span> <span>&#45;&gt;</span> <span><span><a href="../GObject_introspection/Base_info/index.html#type-t">GObject_introspection.Base_info.t</a> Ctypes.structure</span> Ctypes.ptr</span></code></dt><dd><p>Just cast OCaml Ctypes union info to base info</p></dd></dl><dl><dt class="spec value" id="val-from_baseinfo"><a href="#val-from_baseinfo" class="anchor"></a><code><span class="keyword">val</span> from_baseinfo : <span><span><a href="../GObject_introspection/Base_info/index.html#type-t">GObject_introspection.Base_info.t</a> Ctypes.structure</span> Ctypes.ptr</span> <span>&#45;&gt;</span> <span><span><a href="index.html#type-t">t</a> Ctypes.structure</span> Ctypes.ptr</span></code></dt><dd><p>Return a Union_info.t from a Base_info.t, the underlying C structure ref count is increased and the value is Gc.finalis&quot;ed&quot; with Base_info.baseinfo_unref.</p></dd></dl><dl><dt class="spec value" id="val-to_baseinfo"><a href="#val-to_baseinfo" class="anchor"></a><code><span class="keyword">val</span> to_baseinfo : <span><span><a href="index.html#type-t">t</a> Ctypes.structure</span> Ctypes.ptr</span> <span>&#45;&gt;</span> <span><span><a href="../GObject_introspection/Base_info/index.html#type-t">GObject_introspection.Base_info.t</a> Ctypes.structure</span> Ctypes.ptr</span></code></dt><dd><p>Return a Base_info.t form a Union_info, the underlying C structure ref count is increased and the value is Gc.finalis&quot;ed&quot; with Base_info.baseinfo_unref.</p></dd></dl><dl><dt class="spec value" id="val-cast_from_registeredtypeinfo"><a href="#val-cast_from_registeredtypeinfo" class="anchor"></a><code><span class="keyword">val</span> cast_from_registeredtypeinfo : <span><span><a href="../GObject_introspection/Registered_type_info/index.html#type-t">GObject_introspection.Registered_type_info.t</a> Ctypes.structure</span> Ctypes.ptr</span> <span>&#45;&gt;</span> <span><span><a href="index.html#type-t">t</a> Ctypes.structure</span> Ctypes.ptr</span></code></dt><dd><p>Just cast OCaml Ctypes registeredtype info to union info.</p></dd></dl><dl><dt class="spec value" id="val-cast_to_registeredtypeinfo"><a href="#val-cast_to_registeredtypeinfo" class="anchor"></a><code><span class="keyword">val</span> cast_to_registeredtypeinfo : <span><span><a href="index.html#type-t">t</a> Ctypes.structure</span> Ctypes.ptr</span> <span>&#45;&gt;</span> <span><span><a href="../GObject_introspection/Registered_type_info/index.html#type-t">GObject_introspection.Registered_type_info.t</a> Ctypes.structure</span> Ctypes.ptr</span></code></dt><dd><p>Just cast OCaml Ctypes union info to registeredtype info</p></dd></dl><dl><dt class="spec value" id="val-from_registeredtypeinfo"><a href="#val-from_registeredtypeinfo" class="anchor"></a><code><span class="keyword">val</span> from_registeredtypeinfo : <span><span><a href="../GObject_introspection/Registered_type_info/index.html#type-t">GObject_introspection.Registered_type_info.t</a> Ctypes.structure</span> Ctypes.ptr</span> <span>&#45;&gt;</span> <span><span><a href="index.html#type-t">t</a> Ctypes.structure</span> Ctypes.ptr</span></code></dt><dd><p>Return a Union_info.t from a Registered_type_info.t, the underlying C structure ref count is increased and the value is Gc.finalis&quot;ed&quot; with Registered_type_info.registeredtypeinfo_unref.</p></dd></dl><dl><dt class="spec value" id="val-to_registeredtypeinfo"><a href="#val-to_registeredtypeinfo" class="anchor"></a><code><span class="keyword">val</span> to_registeredtypeinfo : <span><span><a href="index.html#type-t">t</a> Ctypes.structure</span> Ctypes.ptr</span> <span>&#45;&gt;</span> <span><span><a href="../GObject_introspection/Registered_type_info/index.html#type-t">GObject_introspection.Registered_type_info.t</a> Ctypes.structure</span> Ctypes.ptr</span></code></dt><dd><p>Return a Registered_type_info.t form a Union_info, the underlying C structure ref count is increased and the value is Gc.finalis&quot;ed&quot; with Registered_type_info.registeredtypeinfo_unref.</p></dd></dl></div></body></html>