bonobo-arg

Name

bonobo-arg -- simplified CORBA_Any wrappers

Synopsis



typedef     BonoboArg;
typedef     BonoboArgType;
#define     BONOBO_ARG_NULL
#define     BONOBO_ARG_BOOLEAN
#define     BONOBO_ARG_INT
#define     BONOBO_ARG_LONG
#define     BONOBO_ARG_STRING
#define     BONOBO_ARG_FLOAT
#define     BONOBO_ARG_DOUBLE
#define     BONOBO_ARG_GET_GENERAL          (a,c,t,e)
#define     BONOBO_ARG_GET_BOOLEAN          (a)
#define     BONOBO_ARG_GET_INT              (a)
#define     BONOBO_ARG_GET_LONG             (a)
#define     BONOBO_ARG_GET_STRING           (a)
#define     BONOBO_ARG_GET_FLOAT            (a)
#define     BONOBO_ARG_GET_DOUBLE           (a)
#define     BONOBO_ARG_SET_GENERAL          (a,v,c,t,e)
#define     BONOBO_ARG_SET_BOOLEAN          (a,v)
#define     BONOBO_ARG_SET_INT              (a,v)
#define     BONOBO_ARG_SET_LONG             (a,v)
#define     BONOBO_ARG_SET_STRING           (a,v)
#define     BONOBO_ARG_SET_FLOAT            (a,v)
#define     BONOBO_ARG_SET_DOUBLE           (a,v)
BonoboArg*  bonobo_arg_new                  (BonoboArgType t);
void        bonobo_arg_release              (BonoboArg *arg);
BonoboArg*  bonobo_arg_copy                 (const BonoboArg *arg);
gboolean    bonobo_arg_is_equal             (BonoboArg *a,
                                             BonoboArg *b,
                                             CORBA_Environment *opt_ev);
GtkType     bonobo_arg_type_to_gtk          (BonoboArgType id);
BonoboArgType bonobo_arg_type_from_gtk      (GtkType t);
void        bonobo_arg_to_gtk               (GtkArg *a,
                                             const BonoboArg *arg);
void        bonobo_arg_from_gtk             (BonoboArg *a,
                                             const GtkArg *arg);
gboolean    bonobo_arg_type_is_equal        (BonoboArgType a,
                                             BonoboArgType b,
                                             CORBA_Environment *opt_ev);

Description

The BonoboArg code, and macros are designed to make the use of CORBA_Any's slightly simpler by providing a glib like binding for them. The bonobo-arg code also provides mappings between Gtk Args and CORBA_anys.

A typical use of the BonoboArg macros would be in

Example 1. Property bag implementation

static void
get_prop (BonoboPropertyBag *bag,
	  BonoboArg         *arg,
	  guint              arg_id,
	  CORBA_Environment *ev,
	  gpointer           user_data)
{
	GtkObject *clock = user_data;

	switch (arg_id) {

	case PROP_RUNNING: {
		BONOBO_ARG_SET_BOOLEAN (arg, is_it_running);
		break;
	}

	default:
		bonobo_exception_set (ev, ex_Bonobo_PropertyBag_NotFound);
		break;
	}
}
     

Details

BonoboArg

typedef CORBA_any      BonoboArg;


BonoboArgType

typedef CORBA_TypeCode BonoboArgType;


BONOBO_ARG_NULL

#define BONOBO_ARG_NULL    TC_null


BONOBO_ARG_BOOLEAN

#define BONOBO_ARG_BOOLEAN TC_boolean


BONOBO_ARG_INT

#define BONOBO_ARG_INT     TC_long


BONOBO_ARG_LONG

#define BONOBO_ARG_LONG    TC_long


BONOBO_ARG_STRING

#define BONOBO_ARG_STRING  TC_string


BONOBO_ARG_FLOAT

#define BONOBO_ARG_FLOAT   TC_float


BONOBO_ARG_DOUBLE

#define BONOBO_ARG_DOUBLE  TC_double


BONOBO_ARG_GET_GENERAL()

#define     BONOBO_ARG_GET_GENERAL(a,c,t,e)

a : 
c : 
t : 
e : 


BONOBO_ARG_GET_BOOLEAN()

#define BONOBO_ARG_GET_BOOLEAN(a)   (BONOBO_ARG_GET_GENERAL (a, TC_boolean, CORBA_boolean, NULL))

a : 


BONOBO_ARG_GET_INT()

#define BONOBO_ARG_GET_INT(a)       (BONOBO_ARG_GET_GENERAL (a, TC_long, CORBA_long, NULL))

a : 


BONOBO_ARG_GET_LONG()

#define BONOBO_ARG_GET_LONG(a)      (BONOBO_ARG_GET_GENERAL (a, TC_long, CORBA_long, NULL))

a : 


BONOBO_ARG_GET_STRING()

#define     BONOBO_ARG_GET_STRING(a)

a : 


BONOBO_ARG_GET_FLOAT()

#define BONOBO_ARG_GET_FLOAT(a)     (BONOBO_ARG_GET_GENERAL (a, TC_float, CORBA_float, NULL))

a : 


BONOBO_ARG_GET_DOUBLE()

#define BONOBO_ARG_GET_DOUBLE(a)    (BONOBO_ARG_GET_GENERAL (a, TC_double, CORBA_double, NULL))

a : 


BONOBO_ARG_SET_GENERAL()

#define     BONOBO_ARG_SET_GENERAL(a,v,c,t,e)

a : 
v : 
c : 
t : 
e : 


BONOBO_ARG_SET_BOOLEAN()

#define BONOBO_ARG_SET_BOOLEAN(a,v) (BONOBO_ARG_SET_GENERAL (a, v, TC_boolean, CORBA_boolean, NULL))

a : 
v : 


BONOBO_ARG_SET_INT()

#define BONOBO_ARG_SET_INT(a,v)     (BONOBO_ARG_SET_GENERAL (a, v, TC_long, CORBA_long, NULL))

a : 
v : 


BONOBO_ARG_SET_LONG()

#define BONOBO_ARG_SET_LONG(a,v)    (BONOBO_ARG_SET_GENERAL (a, v, TC_long, CORBA_long, NULL))

a : 
v : 


BONOBO_ARG_SET_STRING()

#define     BONOBO_ARG_SET_STRING(a,v)

a : 
v : 


BONOBO_ARG_SET_FLOAT()

#define BONOBO_ARG_SET_FLOAT(a,v)   (BONOBO_ARG_SET_GENERAL (a, v, TC_float, CORBA_float, NULL))

a : 
v : 


BONOBO_ARG_SET_DOUBLE()

#define BONOBO_ARG_SET_DOUBLE(a,v)  (BONOBO_ARG_SET_GENERAL (a, v, TC_double, CORBA_double, NULL))

a : 
v : 


bonobo_arg_new ()

BonoboArg*  bonobo_arg_new                  (BonoboArgType t);

Create a new BonoboArg with the specified type the value of the BonoboArg is initially empty.

t : the BonoboArgType eg. TC_long
Returns : 


bonobo_arg_release ()

void        bonobo_arg_release              (BonoboArg *arg);

This frees the memory associated with arg

arg : the bonobo arg.


bonobo_arg_copy ()

BonoboArg*  bonobo_arg_copy                 (const BonoboArg *arg);

This function duplicates a by a deep copy

arg : the bonobo arg
Returns :a copy of arg


bonobo_arg_is_equal ()

gboolean    bonobo_arg_is_equal             (BonoboArg *a,
                                             BonoboArg *b,
                                             CORBA_Environment *opt_ev);

Compares two BonoboArgs 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.

a : a bonobo arg
b : another bonobo arg
opt_ev : optional exception environment or NULL.
Returns : TRUE if a == b


bonobo_arg_type_to_gtk ()

GtkType     bonobo_arg_type_to_gtk          (BonoboArgType id);

This maps a BonoboArgType to a GtkType

id : the BonoboArgType
Returns : the mapped type or 0 on failure


bonobo_arg_type_from_gtk ()

BonoboArgType bonobo_arg_type_from_gtk      (GtkType t);

This maps a GtkType to a BonoboArgType

t : 
Returns : the mapped type or NULL on failure.


bonobo_arg_to_gtk ()

void        bonobo_arg_to_gtk               (GtkArg *a,
                                             const BonoboArg *arg);

Maps a BonoboArg to a GtkArg; a must point to a blank GtkArg.

a : pointer to a blank GtkArk
arg : the BonoboArg to copy


bonobo_arg_from_gtk ()

void        bonobo_arg_from_gtk             (BonoboArg *a,
                                             const GtkArg *arg);

This maps a GtkArg arg to a BonoboArg a; a must point to a freshly allocated BonoboArg eg. such as returned by bonobo_arg_new

a : pointer to blank BonoboArg
arg : GtkArg to copy


bonobo_arg_type_is_equal ()

gboolean    bonobo_arg_type_is_equal        (BonoboArgType a,
                                             BonoboArgType b,
                                             CORBA_Environment *opt_ev);

This compares two BonoboArgType's in a and b. The opt_ev is an optional CORBA_Environment for exceptions, or NULL. This function is commutative.

a : a type code
b : a type code
opt_ev : optional exception environment or NULL.
Returns : TRUE if equal, FALSE if different