![]() |
![]() |
![]() |
Libmatecomponent Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
typedef MateComponentArg; typedef MateComponentArgType; #define MATECOMPONENT_ARG_NULL #define MATECOMPONENT_ARG_BOOLEAN #define MATECOMPONENT_ARG_SHORT #define MATECOMPONENT_ARG_INT #define MATECOMPONENT_ARG_LONG #define MATECOMPONENT_ARG_LONGLONG #define MATECOMPONENT_ARG_FLOAT #define MATECOMPONENT_ARG_DOUBLE #define MATECOMPONENT_ARG_CHAR #define MATECOMPONENT_ARG_STRING #define MATECOMPONENT_ARG_GET_GENERAL (a, c, t, e) #define MATECOMPONENT_ARG_SET_GENERAL (a, v, c, t, e) #define MATECOMPONENT_ARG_GET_BOOLEAN (a) #define MATECOMPONENT_ARG_SET_BOOLEAN (a, v) #define MATECOMPONENT_ARG_GET_SHORT (a) #define MATECOMPONENT_ARG_SET_SHORT (a, v) #define MATECOMPONENT_ARG_GET_INT (a) #define MATECOMPONENT_ARG_SET_INT (a, v) #define MATECOMPONENT_ARG_GET_LONG (a) #define MATECOMPONENT_ARG_SET_LONG (a, v) #define MATECOMPONENT_ARG_GET_LONGLONG (a) #define MATECOMPONENT_ARG_SET_LONGLONG (a, v) #define MATECOMPONENT_ARG_GET_FLOAT (a) #define MATECOMPONENT_ARG_SET_FLOAT (a, v) #define MATECOMPONENT_ARG_GET_DOUBLE (a) #define MATECOMPONENT_ARG_SET_DOUBLE (a, v) #define MATECOMPONENT_ARG_GET_CHAR (a) #define MATECOMPONENT_ARG_SET_CHAR (a, v) #define MATECOMPONENT_ARG_GET_STRING (a) #define MATECOMPONENT_ARG_SET_STRING (a, v) MateComponentArg * matecomponent_arg_new (MateComponentArgType t
); MateComponentArg * matecomponent_arg_new_from (MateComponentArgType t
,gconstpointer data
); void matecomponent_arg_release (MateComponentArg *arg
); MateComponentArg * matecomponent_arg_copy (const MateComponentArg *arg
); void matecomponent_arg_from_gvalue (MateComponentArg *a
,const GValue *value
); MateComponentArgType matecomponent_arg_type_from_gtype (GType t
); void matecomponent_arg_to_gvalue (GValue *value
,const MateComponentArg *arg
); GType matecomponent_arg_type_to_gtype (MateComponentArgType id
); gboolean matecomponent_arg_is_equal (const MateComponentArg *a
,const MateComponentArg *b
,CORBA_Environment *opt_ev
); gboolean matecomponent_arg_type_is_equal (MateComponentArgType a
,MateComponentArgType b
,CORBA_Environment *opt_ev
);
The MateComponentArg code, and macros are designed to make the use of CORBA_Any's slightly simpler by providing a glib like binding for them. The matecomponent-arg code also provides mappings between GValues and CORBA_anys.
A typical use of the MateComponentArg macros would be in
Example 14. Property bag implementation
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
static void get_prop (MateComponentPropertyBag *bag, MateComponentArg *arg, guint arg_id, CORBA_Environment *ev, gpointer user_data) { GObject *clock = user_data; switch (arg_id) { case PROP_RUNNING: { MATECOMPONENT_ARG_SET_BOOLEAN (arg, is_it_running); break; } default: matecomponent_exception_set (ev, ex_MateComponent_PropertyBag_NotFound); break; } } |
typedef CORBA_any MateComponentArg;
A glib style looking type alias for a CORBA_any
typedef CORBA_TypeCode MateComponentArgType;
A glib style looking typedef for a CORBA type description.
#define MATECOMPONENT_ARG_INT TC_CORBA_long
the integer type [ in fact a long ]
# define MATECOMPONENT_ARG_GET_GENERAL(a,c,t,e) ({g_assert (matecomponent_arg_type_is_equal ((a)->_type, c, e)); *((t *)((a)->_value)); })
A macro to extract a value from a MateComponentArg with
the given CORBA type t
.
|
the MateComponentArg |
|
a MateComponentArgType for checking |
|
the C type of the value eg. for MATECOMPONENT_ARG_LONG: CORBA_long |
|
an optional CORBA_Environment or NULL. |
# define MATECOMPONENT_ARG_SET_GENERAL(a,v,c,t,e) ({g_assert (matecomponent_arg_type_is_equal ((a)->_type, c, e)); *((t *)((a)->_value)) = (t)(v); })
A macro to insert a value into an empty MateComponentArg with
the given CORBA type t
.
|
the MateComponentArg |
|
a pointer to the value to insert. |
|
a MateComponentArgType for checking |
|
the C type of the value eg. for MATECOMPONENT_ARG_LONG: CORBA_long |
|
an optional CORBA_Environment or NULL. |
#define MATECOMPONENT_ARG_GET_BOOLEAN(a) (MATECOMPONENT_ARG_GET_GENERAL (a, TC_CORBA_boolean, CORBA_boolean, NULL))
This macro returns a CORBA_boolean from inside a MateComponentArg. If the MateComponentArg's type does not match, the behavior is undefined, and may cause faults.
|
the MateComponentArg to extract the value from. |
#define MATECOMPONENT_ARG_SET_BOOLEAN(a,v) (MATECOMPONENT_ARG_SET_GENERAL (a, v, TC_CORBA_boolean, CORBA_boolean, NULL))
This macro sets the value of a
to contain v
|
the MateComponent arg to insert the value into |
|
a CORBA_boolean. |
#define MATECOMPONENT_ARG_GET_SHORT(a) (MATECOMPONENT_ARG_GET_GENERAL (a, TC_CORBA_short, CORBA_short, NULL))
This macro returns a CORBA_short from inside a MateComponentArg. If the MateComponentArg's type does not match, the behavior is undefined, and may cause faults.
|
the MateComponentArg to extract the value from. |
#define MATECOMPONENT_ARG_SET_SHORT(a,v) (MATECOMPONENT_ARG_SET_GENERAL (a, v, TC_CORBA_short, CORBA_short, NULL))
This macro sets the value of a
to contain v
|
the MateComponent arg to insert the value into |
|
a CORBA_short. |
#define MATECOMPONENT_ARG_GET_INT(a) (MATECOMPONENT_ARG_GET_GENERAL (a, TC_CORBA_long, CORBA_long, NULL))
this macro returns a CORBA_long from inside a MateComponentArg, if the MateComponentArg's type does not match, the behavior is undefined, and may cause faults.
|
the MateComponentArg to extract the value from. |
#define MATECOMPONENT_ARG_SET_INT(a,v) (MATECOMPONENT_ARG_SET_GENERAL (a, v, TC_CORBA_long, CORBA_long, NULL))
This macro sets the value of a
to contain v
|
the MateComponent arg to insert the value into |
|
a CORBA_long. |
#define MATECOMPONENT_ARG_GET_LONG(a) (MATECOMPONENT_ARG_GET_GENERAL (a, TC_CORBA_long, CORBA_long, NULL))
this macro returns a CORBA_long from from inside a MateComponentArg, if the MateComponentArg's type does not match, the behavior is undefined, and may cause faults.
|
the MateComponentArg to extract the value from. |
#define MATECOMPONENT_ARG_SET_LONG(a,v) (MATECOMPONENT_ARG_SET_GENERAL (a, v, TC_CORBA_long, CORBA_long, NULL))
This macro sets the value of a
to contain v
|
the MateComponent arg to insert the value into |
|
a CORBA_long. |
#define MATECOMPONENT_ARG_GET_LONGLONG(a) (MATECOMPONENT_ARG_GET_GENERAL (a, TC_CORBA_long_long, CORBA_long_long, NULL))
this macro returns a CORBA_long_long from from inside a MateComponentArg, if the MateComponentArg's type does not match, the behavior is undefined, and may cause faults.
|
the MateComponentArg to extract the value from. |
#define MATECOMPONENT_ARG_SET_LONGLONG(a,v) (MATECOMPONENT_ARG_SET_GENERAL (a, v, TC_CORBA_long_long, CORBA_long_long, NULL))
This macro sets the value of a
to contain v
|
the MateComponent arg to insert the value into |
|
a CORBA_long_long. |
#define MATECOMPONENT_ARG_GET_FLOAT(a) (MATECOMPONENT_ARG_GET_GENERAL (a, TC_CORBA_float, CORBA_float, NULL))
this macro returns a CORBA_float from inside a MateComponentArg, if the MateComponentArg's type does not match, the behavior is undefined, and may cause faults.
|
the MateComponentArg to extract the value from. |
#define MATECOMPONENT_ARG_SET_FLOAT(a,v) (MATECOMPONENT_ARG_SET_GENERAL (a, v, TC_CORBA_float, CORBA_float, NULL))
This macro sets the value of a
to contain v
|
the MateComponent arg to insert the value into |
|
a CORBA_float. |
#define MATECOMPONENT_ARG_GET_DOUBLE(a) (MATECOMPONENT_ARG_GET_GENERAL (a, TC_CORBA_double, CORBA_double, NULL))
This macro returns a CORBA_double from inside a MateComponentArg. If the MateComponentArg's type does not match, the behavior is undefined, and may cause faults.
|
the MateComponentArg to extract the value from. |
#define MATECOMPONENT_ARG_SET_DOUBLE(a,v) (MATECOMPONENT_ARG_SET_GENERAL (a, v, TC_CORBA_double, CORBA_double, NULL))
This macro sets the value of a
to contain v
|
the MateComponent arg to insert the value into |
|
a CORBA_double. |
#define MATECOMPONENT_ARG_GET_CHAR(a) (MATECOMPONENT_ARG_GET_GENERAL (a, TC_CORBA_char, CORBA_char, NULL))
This macro returns a CORBA_char from inside a MateComponentArg, If the MateComponentArg's type does not match, the behavior is undefined, and may cause faults.
|
the MateComponentArg to extract the value from. |
#define MATECOMPONENT_ARG_SET_CHAR(a,v) (MATECOMPONENT_ARG_SET_GENERAL (a, v, TC_CORBA_char, CORBA_char, NULL))
This macro sets the value of a
to contain v
|
the MateComponent arg to insert the value into |
|
a CORBA_char. |
#define MATECOMPONENT_ARG_GET_STRING(a) ({g_assert ((a)->_type->kind == CORBA_tk_string); *((CORBA_char **)((a)->_value)); })
this macro returns a const CORBA_char * from from inside a
MateComponentArg, if the MateComponentArg's type does not match, the
behavior is undefined, and may cause faults. The
pointer to the string is only valid for the scope of
the lifetime of a
.
|
the MateComponentArg to extract the value from. |
#define MATECOMPONENT_ARG_SET_STRING(a,v) ({g_assert ((a)->_type->kind == CORBA_tk_string); CORBA_free (*(char **)(a)->_value); *((CORBA_char **)((a)->_value)) = CORBA_string_dup ((v)?(v):""); })
This macro sets the value of a
to contain a
duplicated copy of v
|
the MateComponent arg to insert the value into |
|
a CORBA_char *. |
MateComponentArg * matecomponent_arg_new (MateComponentArgType t
);
Create a new MateComponentArg with the specified type the value of the MateComponentArg is initially empty.
|
the MateComponentArgType eg. TC_CORBA_long |
Returns : |
the new MateComponentArg |
MateComponentArg * matecomponent_arg_new_from (MateComponentArgType t
,gconstpointer data
);
Create a new MateComponentArg with the specified type and data
|
the MateComponentArgType eg. TC_CORBA_long |
|
the data for the MateComponentArg to be created |
Returns : |
the new MateComponentArg |
void matecomponent_arg_release (MateComponentArg *arg
);
This frees the memory associated with arg
|
the matecomponent arg. |
MateComponentArg * matecomponent_arg_copy (const MateComponentArg *arg
);
This function duplicates a
by a deep copy
|
the matecomponent arg |
Returns : |
a copy of arg
|
void matecomponent_arg_from_gvalue (MateComponentArg *a
,const GValue *value
);
This maps a GValue value
to a MateComponentArg a
;
a
must point to a freshly allocated MateComponentArg
eg. such as returned by matecomponent_arg_new
|
pointer to blank MateComponentArg |
|
GValue to copy |
MateComponentArgType matecomponent_arg_type_from_gtype (GType t
);
void matecomponent_arg_to_gvalue (GValue *value
,const MateComponentArg *arg
);
Maps a MateComponentArg to a GtkArg; a
must point
to a blank GtkArg.
|
pointer to a blank GValue |
|
the MateComponentArg to copy |
GType matecomponent_arg_type_to_gtype (MateComponentArgType id
);
This maps a MateComponentArgType to a GType
|
the MateComponentArgType |
Returns : |
the mapped type or 0 on failure |
gboolean matecomponent_arg_is_equal (const MateComponentArg *a
,const MateComponentArg *b
,CORBA_Environment *opt_ev
);
Compares two MateComponentArg's for equivalence; will return TRUE
if equivalent for all simple cases. For Object references
CORBA sometimes denies 2 object references are equivalent
even if they are [ this is a feature_not_bug ].
This function is commutative.
gboolean matecomponent_arg_type_is_equal (MateComponentArgType a
,MateComponentArgType b
,CORBA_Environment *opt_ev
);
This compares two MateComponentArgType's in a
and b
.
The opt_ev
is an optional CORBA_Environment for
exceptions, or NULL
. This function is commutative.