XedMessageType

XedMessageType — message type description

Functions

Types and Values

Object Hierarchy

    GBoxed
    ╰── XedMessageType

Includes

#include <xed/xed-message-type.h>

Description

A message type is a prototype description for a XedMessage used to transmit messages on a XedMessageBus. The message type describes the Object Path, Method and Arguments of the message.

A message type can contain any number of required and optional arguments. To instantiate a XedMessage from a XedMessageType, use xed_message_type_instantiate().

Registering a new message type on a XedMessageBus with xed_message_bus_register() internally creates a new XedMessageType. When then using xed_message_bus_send(), an actual instantiation of the registered type is internally created and send over the bus.

Example 4. 

1
2
3
4
5
6
7
8
9
10
11
// Defining a new message type
XedMessageType *message_type = xed_message_type_new ("/plugins/example",
                                                         "method",
                                                         0,
                                                         "arg1", G_TYPE_STRING,
                                                         NULL);

// Instantiating an actual message from the type
XedMessage *message = xed_message_type_instantiate (message_type,
                                                        "arg1", "Hello World",
                                                        NULL);

Functions

xed_message_type_get_type ()

GType
xed_message_type_get_type (void);

Retrieves the GType object which is associated with the XedMessageType class.

Returns

the GType associated with XedMessageType.


xed_message_type_is_supported ()

gboolean
xed_message_type_is_supported (GType type);

Returns if type is GType supported by the message system.

Parameters

type

the GType

 

Returns

TRUE if type is a supported GType


xed_message_type_identifier ()

gchar *
xed_message_type_identifier (const gchar *object_path,
                             const gchar *method);

Get the string identifier for method at object_path .

Parameters

object_path

the object path.

[allow-none]

method

the method.

[allow-none]

Returns

the identifier for method at object_path


xed_message_type_is_valid_object_path ()

gboolean
xed_message_type_is_valid_object_path (const gchar *object_path);

Returns whether object_path is a valid object path

Parameters

object_path

the object path.

[allow-none]

Returns

TRUE if object_path is a valid object path


xed_message_type_new ()

XedMessageType *
xed_message_type_new (const gchar *object_path,
                      const gchar *method,
                      guint num_optional,
                      ...);

Create a new XedMessageType for method at object_path . Argument names and values are supplied by the NULL terminated variable argument list. The last num_optional provided arguments are considered optional.

Parameters

object_path

the object path.

[allow-none]

method

the method.

[allow-none]

num_optional

number of optional arguments

 

...

key/gtype pair variable argument list

 

Returns

the newly constructed XedMessageType


xed_message_type_new_valist ()

XedMessageType *
xed_message_type_new_valist (const gchar *object_path,
                             const gchar *method,
                             guint num_optional,
                             va_list va_args);

Create a new XedMessageType for method at object_path . Argument names and values are supplied by the NULL terminated variable argument list. The last num_optional provided arguments are considered optional.

Parameters

object_path

the object path.

[allow-none]

method

the method.

[allow-none]

num_optional

number of optional arguments

 

var_args

key/gtype pair variable argument list

 

Returns

the newly constructed XedMessageType


xed_message_type_ref ()

XedMessageType *
xed_message_type_ref (XedMessageType *message_type);

Increases the reference count on message_type .

Parameters

message_type

the XedMessageType

 

Returns

message_type


xed_message_type_unref ()

void
xed_message_type_unref (XedMessageType *message_type);

Decreases the reference count on message_type . When the reference count drops to 0, message_type is destroyed.

Parameters

message_type

the XedMessageType

 

xed_message_type_set ()

void
xed_message_type_set (XedMessageType *message_type,
                      guint num_optional,
                      ...);

Sets argument names/types supplied by the NULL terminated variable argument list. The last num_optional provided arguments are considered optional.

Parameters

message_type

the XedMessageType

 

num_optional

number of optional arguments

 

...

key/gtype pair variable argument list

 

xed_message_type_set_valist ()

void
xed_message_type_set_valist (XedMessageType *message_type,
                             guint num_optional,
                             va_list va_args);

Sets argument names/types supplied by the NULL terminated variable argument list var_args . The last num_optional provided arguments are considered optional.

Parameters

message_type

the XedMessageType

 

num_optional

number of optional arguments

 

var_args

key/gtype pair variable argument list

 

xed_message_type_instantiate ()

XedMessage *
xed_message_type_instantiate (XedMessageType *message_type,
                              ...);

Instantiate a new message from the message type with specific values for the message arguments.

Parameters

message_type

the XedMessageType

 

...

NULL terminated variable list of key/value pairs

 

Returns

the newly created message.

[transfer full]


xed_message_type_instantiate_valist ()

XedMessage *
xed_message_type_instantiate_valist (XedMessageType *message_type,
                                     va_list va_args);

Instantiate a new message from the message type with specific values for the message arguments.

Parameters

message_type

the XedMessageType

 

va_args

NULL terminated variable list of key/value pairs

 

Returns

the newly created message.

[transfer full]


xed_message_type_get_object_path ()

const gchar *
xed_message_type_get_object_path (XedMessageType *message_type);

Get the message type object path.

Parameters

message_type

the XedMessageType

 

Returns

the message type object path


xed_message_type_get_method ()

const gchar *
xed_message_type_get_method (XedMessageType *message_type);

Get the message type method.

Parameters

message_type

the XedMessageType

 

Returns

the message type method


xed_message_type_lookup ()

GType
xed_message_type_lookup (XedMessageType *message_type,
                         const gchar *key);

Get the argument key GType.

Parameters

message_type

the XedMessageType

 

key

the argument key

 

Returns

the GType of key


xed_message_type_foreach ()

void
xed_message_type_foreach (XedMessageType *message_type,
                          XedMessageTypeForeach func,
                          gpointer user_data);

Calls func for each argument in the message type.

Parameters

message_type

the XedMessageType

 

func

the callback function.

[scope call]

user_data

user data supplied to the callback function

 

Types and Values

XedMessageType

typedef struct _XedMessageType XedMessageType;