Re: macro problem, extra heirarchy?



Chris Wiegand wrote:
> 
> Um...first off, while wrapping gda_field, I found this line:
> 
> #define gda_field_single(f)         ((f)->real_value->_u.v._u.f)
> 
> It kept choking until I got my brain in gear and figured out why: f is
> being reused! I didn't want to change it, being as it's not my code, nor
> in my folder, and so someone familiar with the code should probably change
> the gda_field_single(f) and (f)-> into something like a g or somesuch...
> 
done! It's on CVS

> Also, can someone explain why Gda_Field, Gda_Value, and Gda_FieldValue are
> all separate? I can't quite figure out why... (no offense intended, I
> assure you!)
> 
This is because they are mapped directly from the CORBA interfaces, but
for the client part, you should just make C++ bindings for the stuff in
the .h files in the gda-clnt directory. Don't try to wrap the CORBA
stuff, as the gda-client lib gets the responsibility for that. 

GDA_Field is the CORBA interface for the field with no further info
GDA_Value is the structure containing the value for a field
GDA_FieldValue is just a wrapper to know if there is a valid GDA_Value
for a given GDA_Field. If you look at the gda-field.h file, you'll see:

#define gda_field_isnull(f)         (f->real_value ? (f)->real_value->_d
: 1)

'real_value' is a GDA_FieldValue struct, and the _d is a member
generated by orbit-idl from the IDL file:

union FieldValue switch (boolean) {
        case FALSE:
                Value v;
        };

this 'FALSE' is a flag, if TRUE, the FieldValue is null and has no
GDA_Field associated, if FALSE, the FieldValue is not null, and has a
GDA_Field associated.

This is used in the Gda_Field struct (in gda-field.h) to have several
values for the Field:

struct _Gda_Field
{
  GtkObject            object;
  GDA_FieldAttributes* attributes;
  gint                 actual_length;
  GDA_FieldValue*      real_value;
  GDA_FieldValue*      shadow_value;
  GDA_FieldValue*      original_value;
};

Although all this is not yet supported by the client lib, so just wrap
the functions already available. Remember that all structures starting
by GDA_ are CORBA ones, so unless explicitly used in the client lib,
forget about them.

Cheers




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]