Re: Question about the IDL ...



> Hello!!
> 
> I have one question. When i have this method at the IDL:
> 
>     any  readChunk (in long start, in long size)
> 
> How i must map it into C? As i have been reading it should be various
> methods at the server part to represent gboolean, gint, gfloat, etc...
> Then, at the client side... What i must do? One method which specifies
> the type of the data we must receive and then call the correct method?
> 
you must map this method into a function of the form:

gpointer readChunk (Gda_ReportStream *stream, long start, long size);

what must be done is to map the CORBA_any to a gpointer. If you see at
/usr/include/orb/corba_any_type, you'll see that a CORBA_any is a pointer
to a structure (CORBA_any_type) which contains:

struct CORBA_any_type {
        CORBA_TypeCode _type;
        gpointer _value;
        CORBA_boolean _release;
};

So the thing to do here is to just make a copy of the _value field, since we
don't care about the type being returned: it's always binary data. And wait,
this makes me think that it would be better to return a sequence of bytes,
which makes more sense.

Let me change this... done. The idl is now:

        typedef sequence<octet> ReportStreamChunk;
        interface ReportStream {
                readonly attribute any contents;

                ReportStreamChunk readChunk (in long start, in long size);
                long writeChunk (in ReportStreamChunk data, in long size);
        };

cheers





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