Blame docs/reference/glib/html/glib-Datasets.html

Packit ae235b
Packit ae235b
<html>
Packit ae235b
<head>
Packit ae235b
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
Packit ae235b
<title>Datasets: GLib Reference Manual</title>
Packit ae235b
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
Packit ae235b
<link rel="home" href="index.html" title="GLib Reference Manual">
Packit ae235b
<link rel="up" href="glib-data-types.html" title="GLib Data Types">
Packit ae235b
<link rel="prev" href="glib-Keyed-Data-Lists.html" title="Keyed Data Lists">
Packit ae235b
<link rel="next" href="glib-GVariantType.html" title="GVariantType">
Packit ae235b
<meta name="generator" content="GTK-Doc V1.27 (XML mode)">
Packit ae235b
<link rel="stylesheet" href="style.css" type="text/css">
Packit ae235b
</head>
Packit ae235b
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
Packit ae235b
Packit ae235b
Packit ae235b
Top  | 
Packit ae235b
                  Description
Packit ae235b
Packit ae235b
Home
Packit ae235b
Up
Packit ae235b
Prev
Packit ae235b
Next
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Datasets

Packit ae235b

Datasets — associate groups of data elements with

Packit ae235b
                    particular memory locations

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Functions

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
#define
Packit ae235b
Packit ae235b
g_dataset_id_set_data()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
void
Packit ae235b
Packit ae235b
Packit ae235b
g_dataset_id_set_data_full ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
void
Packit ae235b
Packit ae235b
Packit ae235b
(*GDestroyNotify) ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
gpointer
Packit ae235b
Packit ae235b
Packit ae235b
g_dataset_id_get_data ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
#define
Packit ae235b
Packit ae235b
g_dataset_id_remove_data()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
gpointer
Packit ae235b
Packit ae235b
Packit ae235b
g_dataset_id_remove_no_notify ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
#define
Packit ae235b
Packit ae235b
g_dataset_set_data()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
#define
Packit ae235b
Packit ae235b
g_dataset_set_data_full()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
#define
Packit ae235b
Packit ae235b
g_dataset_get_data()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
#define
Packit ae235b
Packit ae235b
g_dataset_remove_data()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
#define
Packit ae235b
Packit ae235b
g_dataset_remove_no_notify()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
void
Packit ae235b
Packit ae235b
Packit ae235b
g_dataset_foreach ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
void
Packit ae235b
Packit ae235b
Packit ae235b
(*GDataForeachFunc) ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
void
Packit ae235b
Packit ae235b
Packit ae235b
g_dataset_destroy ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Includes

Packit ae235b
#include <gmodule.h>
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Description

Packit ae235b

Datasets associate groups of data elements with particular memory

Packit ae235b
locations. These are useful if you need to associate data with a
Packit ae235b
structure returned from an external library. Since you cannot modify
Packit ae235b
the structure, you use its location in memory as the key into a
Packit ae235b
dataset, where you can associate any number of data elements with it.

Packit ae235b

There are two forms of most of the dataset functions. The first form

Packit ae235b
uses strings to identify the data elements associated with a
Packit ae235b
location. The second form uses GQuark identifiers, which are
Packit ae235b
created with a call to g_quark_from_string() or
Packit ae235b
g_quark_from_static_string(). The second form is quicker, since it
Packit ae235b
does not require looking up the string in the hash table of GQuark
Packit ae235b
identifiers.

Packit ae235b

There is no function to create a dataset. It is automatically

Packit ae235b
created as soon as you add elements to it.

Packit ae235b

To add data elements to a dataset use g_dataset_id_set_data(),

Packit ae235b
g_dataset_id_set_data_full(), g_dataset_set_data() and
Packit ae235b
g_dataset_set_data_full().

Packit ae235b

To get data elements from a dataset use g_dataset_id_get_data() and

Packit ae235b
g_dataset_get_data().

Packit ae235b

To iterate over all data elements in a dataset use

Packit ae235b
g_dataset_foreach() (not thread-safe).

Packit ae235b

To remove data elements from a dataset use

Packit ae235b
g_dataset_id_remove_data() and g_dataset_remove_data().

Packit ae235b

To destroy a dataset, use g_dataset_destroy().

Packit ae235b
Packit ae235b
Packit ae235b

Functions

Packit ae235b
Packit ae235b

g_dataset_id_set_data()

Packit ae235b
#define             g_dataset_id_set_data(l, k, d)
Packit ae235b

Sets the data element associated with the given GQuark id. Any

Packit ae235b
previous data with the same key is removed, and its destroy function
Packit ae235b
is called.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

l

Packit ae235b

the location identifying the dataset.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

k

Packit ae235b

the GQuark id to identify the data element.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

d

Packit ae235b

the data element.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_dataset_id_set_data_full ()

Packit ae235b
void
Packit ae235b
g_dataset_id_set_data_full (gconstpointer dataset_location,
Packit ae235b
                            GQuark key_id,
Packit ae235b
                            gpointer data,
Packit ae235b
                            GDestroyNotify destroy_func);
Packit ae235b

Sets the data element associated with the given GQuark id, and also

Packit ae235b
the function to call when the data element is destroyed. Any
Packit ae235b
previous data with the same key is removed, and its destroy function
Packit ae235b
is called.

Packit ae235b

[skip]

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

dataset_location

Packit ae235b

the location identifying the dataset.

Packit ae235b
[not nullable]
Packit ae235b
Packit ae235b
Packit ae235b

key_id

Packit ae235b

the GQuark id to identify the data element.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

data

Packit ae235b

the data element.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

destroy_func

Packit ae235b

the function to call when the data element is

Packit ae235b
removed. This function will be called with the data
Packit ae235b
element and can be used to free any memory allocated
Packit ae235b
for it.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

GDestroyNotify ()

Packit ae235b
void
Packit ae235b
(*GDestroyNotify) (gpointer data);
Packit ae235b

Specifies the type of function which is called when a data element

Packit ae235b
is destroyed. It is passed the pointer to the data element and
Packit ae235b
should free any memory and resources allocated for it.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

data

Packit ae235b

the data element.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_dataset_id_get_data ()

Packit ae235b
gpointer
Packit ae235b
g_dataset_id_get_data (gconstpointer dataset_location,
Packit ae235b
                       GQuark key_id);
Packit ae235b

Gets the data element corresponding to a GQuark.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

dataset_location

Packit ae235b

the location identifying the dataset.

Packit ae235b
[not nullable]
Packit ae235b
Packit ae235b
Packit ae235b

key_id

Packit ae235b

the GQuark id to identify the data element.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

the data element corresponding to

Packit ae235b
the GQuark, or NULL if it is not found. 

Packit ae235b

[transfer none][nullable]

Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_dataset_id_remove_data()

Packit ae235b
#define             g_dataset_id_remove_data(l, k)
Packit ae235b

Removes a data element from a dataset. The data element's destroy

Packit ae235b
function is called if it has been set.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

l

Packit ae235b

the location identifying the dataset.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

k

Packit ae235b

the GQuark id identifying the data element.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_dataset_id_remove_no_notify ()

Packit ae235b
gpointer
Packit ae235b
g_dataset_id_remove_no_notify (gconstpointer dataset_location,
Packit ae235b
                               GQuark key_id);
Packit ae235b

Removes an element, without calling its destroy notification

Packit ae235b
function.

Packit ae235b

[skip]

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

dataset_location

Packit ae235b

the location identifying the dataset.

Packit ae235b
[not nullable]
Packit ae235b
Packit ae235b
Packit ae235b

key_id

Packit ae235b

the GQuark ID identifying the data element.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

the data previously stored at key_id

Packit ae235b
,
Packit ae235b
or NULL if none. 

Packit ae235b

[nullable]

Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_dataset_set_data()

Packit ae235b
#define             g_dataset_set_data(l, k, d)
Packit ae235b

Sets the data corresponding to the given string identifier.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

l

Packit ae235b

the location identifying the dataset.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

k

Packit ae235b

the string to identify the data element.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

d

Packit ae235b

the data element.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_dataset_set_data_full()

Packit ae235b
#define             g_dataset_set_data_full(l, k, d, f)
Packit ae235b

Sets the data corresponding to the given string identifier, and the

Packit ae235b
function to call when the data element is destroyed.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

l

Packit ae235b

the location identifying the dataset.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

k

Packit ae235b

the string to identify the data element.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

d

Packit ae235b

the data element.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

f

Packit ae235b

the function to call when the data element is removed. This

Packit ae235b
function will be called with the data element and can be used to
Packit ae235b
free any memory allocated for it.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_dataset_get_data()

Packit ae235b
#define             g_dataset_get_data(l, k)
Packit ae235b

Gets the data element corresponding to a string.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

l

Packit ae235b

the location identifying the dataset.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

k

Packit ae235b

the string identifying the data element.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

the data element corresponding to

Packit ae235b
the string, or NULL if it is not found. 

Packit ae235b

[transfer none][nullable]

Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_dataset_remove_data()

Packit ae235b
#define             g_dataset_remove_data(l, k)
Packit ae235b

Removes a data element corresponding to a string. Its destroy

Packit ae235b
function is called if it has been set.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

l

Packit ae235b

the location identifying the dataset.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

k

Packit ae235b

the string identifying the data element.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_dataset_remove_no_notify()

Packit ae235b
#define             g_dataset_remove_no_notify(l, k)
Packit ae235b

Removes an element, without calling its destroy notifier.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

l

Packit ae235b

the location identifying the dataset.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

k

Packit ae235b

the string identifying the data element.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_dataset_foreach ()

Packit ae235b
void
Packit ae235b
g_dataset_foreach (gconstpointer dataset_location,
Packit ae235b
                   GDataForeachFunc func,
Packit ae235b
                   gpointer user_data);
Packit ae235b

Calls the given function for each data element which is associated

Packit ae235b
with the given location. Note that this function is NOT thread-safe.
Packit ae235b
So unless dataset_location
Packit ae235b
 can be protected from any modifications
Packit ae235b
during invocation of this function, it should not be called.

Packit ae235b

func

Packit ae235b
 can make changes to the dataset, but the iteration will not
Packit ae235b
reflect changes made during the g_dataset_foreach() call, other
Packit ae235b
than skipping over elements that are removed.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

dataset_location

Packit ae235b

the location identifying the dataset.

Packit ae235b
[not nullable]
Packit ae235b
Packit ae235b
Packit ae235b

func

Packit ae235b

the function to call for each data element.

Packit ae235b
[scope call]
Packit ae235b
Packit ae235b
Packit ae235b

user_data

Packit ae235b

user data to pass to the function.

Packit ae235b
[closure]
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

GDataForeachFunc ()

Packit ae235b
void
Packit ae235b
(*GDataForeachFunc) (GQuark key_id,
Packit ae235b
                     gpointer data,
Packit ae235b
                     gpointer user_data);
Packit ae235b

Specifies the type of function passed to g_dataset_foreach(). It is

Packit ae235b
called with each GQuark id and associated data element, together
Packit ae235b
with the user_data
Packit ae235b
 parameter supplied to g_dataset_foreach().

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

key_id

Packit ae235b

the GQuark id to identifying the data element.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

data

Packit ae235b

the data element.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

user_data

Packit ae235b

user data passed to g_dataset_foreach().

Packit ae235b
[closure]
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_dataset_destroy ()

Packit ae235b
void
Packit ae235b
g_dataset_destroy (gconstpointer dataset_location);
Packit ae235b

Destroys the dataset, freeing all memory allocated, and calling any

Packit ae235b
destroy functions set for data elements.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

dataset_location

Packit ae235b

the location identifying the dataset.

Packit ae235b
[not nullable]
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Types and Values

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Generated by GTK-Doc V1.27
Packit ae235b
</body>
Packit ae235b
</html>