| Iris Manual | ||||
|---|---|---|---|---|
| Top | Description | ||||
#define IRIS_TYPE_MESSAGE IrisMessage; GType iris_message_get_type (void); IrisMessage* iris_message_new (gint what); IrisMessage* iris_message_new_data (gint what, GType type, ...); IrisMessage* iris_message_new_full (gint what, const gchar *first_name, ...); IrisMessage* iris_message_ref (IrisMessage *message); void iris_message_unref (IrisMessage *message); IrisMessage* iris_message_copy (IrisMessage *message); const GValue* iris_message_get_data (IrisMessage *message); void iris_message_set_data (IrisMessage *message, const GValue *value); guint iris_message_count_names (IrisMessage *message); gboolean iris_message_is_empty (IrisMessage *message); gboolean iris_message_contains (IrisMessage *message, const gchar *name); void iris_message_get_value (IrisMessage *message, const gchar *name, GValue *value); void iris_message_set_value (IrisMessage *message, const gchar *name, const GValue *value); const gchar* iris_message_get_string (IrisMessage *message, const gchar *name); void iris_message_set_string (IrisMessage *message, const gchar *name, const gchar *value); gint iris_message_get_int (IrisMessage *message, const gchar *name); void iris_message_set_int (IrisMessage *message, const gchar *name, gint value); gint64 iris_message_get_int64 (IrisMessage *message, const gchar *name); void iris_message_set_int64 (IrisMessage *message, const gchar *name, gint64 value); gfloat iris_message_get_float (IrisMessage *message, const gchar *name); void iris_message_set_float (IrisMessage *message, const gchar *name, gfloat value); gdouble iris_message_get_double (IrisMessage *message, const gchar *name); void iris_message_set_double (IrisMessage *message, const gchar *name, gdouble value); glong iris_message_get_long (IrisMessage *message, const gchar *name); void iris_message_set_long (IrisMessage *message, const gchar *name, glong value); gulong iris_message_get_ulong (IrisMessage *message, const gchar *name); void iris_message_set_ulong (IrisMessage *message, const gchar *name, gulong value); gchar iris_message_get_char (IrisMessage *message, const gchar *name); void iris_message_set_char (IrisMessage *message, const gchar *name, gchar value); guchar iris_message_get_uchar (IrisMessage *message, const gchar *name); void iris_message_set_uchar (IrisMessage *message, const gchar *name, guchar value); gboolean iris_message_get_boolean (IrisMessage *message, const gchar *name); void iris_message_set_boolean (IrisMessage *message, const gchar *name, gboolean value); gpointer iris_message_get_pointer (IrisMessage *message, const gchar *name); void iris_message_set_pointer (IrisMessage *message, const gchar *name, gpointer value);
IrisMessage is the representation of a message that can be passed within a process. It is typically delivered to a port which can help provide actions based on the message. IrisMessage's contain a set of key/value pairs that describe the message. The message itself also has a type, which is defined by the public "what" member of the IrisMessage struct.
Since messages can be expensive, they are reference counted. You can
control the lifetime of an IrisMessage using iris_message_ref() and
iris_message_unref().
You can add key/values to the message using methods such as
iris_message_set_string() and iris_message_set_value(). There are helpers
for most base types within GLib. For complex types, use
iris_message_set_value() containing a GValue with the complex type.
Named keys uses a hashtable internally which may be more of an
expensive operation than is desired. IrisMessage provides a way to
pack the data into the message using iris_message_set_data(). For
light-weight messages containing a single value this is preferred.
Updating the structure is not thread-safe. Generally it is not recommended to modify a message after passing it.
IrisMessage* iris_message_new (gint what);
Creates a new IrisMessage. what can be any constant used within
your application that the local or remote application knows how to
handle.
|
the message type |
Returns : |
the newly created IrisMessage. |
IrisMessage* iris_message_new_data (gint what, GType type, ...);
Creates a new IrisMessage instance with the data value initialized. The ellipsis parameter is used so you may pass any type of value or pointer into the constructor, however only one is allowed.
|
The message type |
|
the GType of the data element |
|
|
Returns : |
The newly created IrisMessage instance |
IrisMessage* iris_message_new_full (gint what, const gchar *first_name, ...);
Creates a new instance of a IrisMessage and sets its fields.
|
the message type |
|
the name of the first field in the message |
|
the GType and value for the first property, followed optionally
by more name/type/value triplets, follwed by NULL
|
Returns : |
a new instance of IrisMessage. |
IrisMessage* iris_message_ref (IrisMessage *message);
Atomically Increases the reference count of message by one.
|
a IrisMessage |
Returns : |
the passed IrisMessage, with the reference count increased by one. |
void iris_message_unref (IrisMessage *message);
Atomically decrease the reference count of an IrisMessage. If the reference count reaches zero, the object is destroyed and all its allocated resources are freed.
|
An IrisMessage |
IrisMessage* iris_message_copy (IrisMessage *message);
Copies message. If the node contains complex data types then the
reference count of the objects are increased.
|
An IrisMessage |
Returns : |
the copied IrisMessage. |
const GValue* iris_message_get_data (IrisMessage *message);
Retrieves the data value for the IrisMessage. A message may have one data value within it that is not associated with a key. This is that value.
|
An IrisMessage |
Returns : |
A pointer to a GValue that should not be modified. |
void iris_message_set_data (IrisMessage *message, const GValue *value);
Updates the data field for the message. A message may have only one data value within it that is not associated with a key. This is that value.
|
An IrisMessage |
|
A GValue |
guint iris_message_count_names (IrisMessage *message);
Retrieves the number of key/value pairs that are currently stored within the message.
|
An IrisMessage |
Returns : |
the number of key/value pairs |
gboolean iris_message_is_empty (IrisMessage *message);
Checks to see if the message is currently empty, meaning it has no key/value pairs associated.
|
An IrisMessage |
Returns : |
TRUE if there are no key/value pairs associated. |
gboolean iris_message_contains (IrisMessage *message, const gchar *name);
Checks to see if message contains a field named name.
|
An IrisMessage |
|
the name to lookup |
Returns : |
TRUE if the message contains name
|
void iris_message_get_value (IrisMessage *message, const gchar *name, GValue *value);
Copies the value found using name as the key into the GValue
pointed to by value. Remember to unset your value using
g_value_unset() when you are done.
|
An IrisMessage |
|
the name of the value to retrieve |
|
a GValue to store the result in |
void iris_message_set_value (IrisMessage *message, const gchar *name, const GValue *value);
Updates the value for key to use the value pointed to by value.
|
An IrisMessage |
|
the name of the key |
|
A GValue containing the new value |
const gchar* iris_message_get_string (IrisMessage *message, const gchar *name);
Retrieves the value for key which must be a string.
|
An IrisMessage |
|
The key of the item |
Returns : |
a string containing the value for key.
|
void iris_message_set_string (IrisMessage *message, const gchar *name, const gchar *value);
Updates the key for message to the string pointed to by value. The
contents of the string is duplicated and stored within the message.
|
An IrisMessage |
|
the key |
|
a string |
gint iris_message_get_int (IrisMessage *message, const gchar *name);
Retrieves the value for key.
|
An IrisMessage |
|
the key |
Returns : |
the value for key as a gint.
|
void iris_message_set_int (IrisMessage *message, const gchar *name, gint value);
Updates message to use value as the value for key.
|
An IrisMessage |
|
the key |
|
the value |
gint64 iris_message_get_int64 (IrisMessage *message, const gchar *name);
Retrieves the value for key.
|
An IrisMessage |
|
the key |
Returns : |
the value for key as a gint64.
|
void iris_message_set_int64 (IrisMessage *message, const gchar *name, gint64 value);
Updates message to use value as the value for key.
|
An IrisMessage |
|
the key |
|
the value |
gfloat iris_message_get_float (IrisMessage *message, const gchar *name);
Retrieves the value for key.
|
An IrisMessage |
|
the key |
Returns : |
the value for key as a gfloat.
|
void iris_message_set_float (IrisMessage *message, const gchar *name, gfloat value);
Updates message to use value as the value for key.
|
An IrisMessage |
|
the key |
|
the value |
gdouble iris_message_get_double (IrisMessage *message, const gchar *name);
Retrieves the value for key.
|
An IrisMessage |
|
the key |
Returns : |
the value for key as a gdouble.
|
void iris_message_set_double (IrisMessage *message, const gchar *name, gdouble value);
Updates message to use value as the value for key.
|
An IrisMessage |
|
the key |
|
the value |
glong iris_message_get_long (IrisMessage *message, const gchar *name);
Retrieves the value for key.
|
An IrisMessage |
|
the key |
Returns : |
the value for key
|
void iris_message_set_long (IrisMessage *message, const gchar *name, glong value);
Updates message to use value as the value for key.
|
An IrisMessage |
|
the key |
|
the value |
gulong iris_message_get_ulong (IrisMessage *message, const gchar *name);
Retrieves the value for key.
|
An IrisMessage |
|
the key |
Returns : |
the value for key
|
void iris_message_set_ulong (IrisMessage *message, const gchar *name, gulong value);
Updates message to use value as the value for key.
|
An IrisMessage |
|
the key |
|
the value |
gchar iris_message_get_char (IrisMessage *message, const gchar *name);
Retrieves the value for key.
|
An IrisMessage |
|
the key |
Returns : |
the value for key
|
void iris_message_set_char (IrisMessage *message, const gchar *name, gchar value);
Updates message to use value as the value for key.
|
An IrisMessage |
|
the key |
|
the value |
guchar iris_message_get_uchar (IrisMessage *message, const gchar *name);
Retrieves the value for key.
|
An IrisMessage |
|
the key |
Returns : |
the value for key
|
void iris_message_set_uchar (IrisMessage *message, const gchar *name, guchar value);
Updates message to use value as the value for key.
|
An IrisMessage |
|
the key |
|
the value |
gboolean iris_message_get_boolean (IrisMessage *message, const gchar *name);
Retrieves the value for key.
|
An IrisMessage |
|
the key |
Returns : |
the value for key
|
void iris_message_set_boolean (IrisMessage *message, const gchar *name, gboolean value);
Updates message to use value as the value for key.
|
An IrisMessage |
|
the key |
|
the value |
gpointer iris_message_get_pointer (IrisMessage *message, const gchar *name);
Retrieves the value for key.
|
An IrisMessage |
|
the key |
Returns : |
the value for key
|
void iris_message_set_pointer (IrisMessage *message, const gchar *name, gpointer value);
Updates message to use value as the value for key.
|
An IrisMessage |
|
the key |
|
the value |