Re: [gnome-db]a Gda_Report object doubt...



On 06 Feb 2001 23:06:29 +0100, Carlos Perelló Marín wrote:
> Well, I'm at this moment implementing the Gda_report object at the
> client side of the report engine and I have one duobt. I you read the
> IDL you can get a Gda_Report from to ways:
> 
> 1- Adding a new Report to the Report Engine.
> 2.- Getting a previously created one.
> 
> 
> Well, I'm writing the object design and I have add to the gda_report_new
> method the CORBA call to "add" a new Report Object to the Report Engine
> because the previously created ones are got with
> GDA_ReportEngine_queryReports:
> 
> <code>
> 
> #ifdef HAVE_GOBJECT
>       object = GDA_REPORT (g_object_new (GDA_TYPE_REPORT, NULL));
> #else
>       object = gtk_type_new(gda_report_get_type());
> #endif
>       object->engine = engine;
>       CORBA_exception_init(&ev);
>       object->corba_report = GDA_ReportEngine_addReport(engine->corba_engine,
> \
>                       
>                                 rep_name, description, &ev);
> </code>
> 
> When I implement the gda_report_free I shouldn't call the
> GDA_ReportEngine_removeReport method, because if I do it I can't free
> the Report Object that I will not use any more at this session but that
> will be at the Report Engine, so I will create a gda_report_remove
> method to do it and the _free will be only to free the Object.
> 

I don't think we should call GDA_ReportEngine_addReport in
gda_report_free, since Gda_Report
is an object to manage a GDA_Report CORBA object, not only to add it to
the report system (which
is what GDA_ReportEngine_addReport is intended to do).

In the IDL, reports are never created, so the client API should match
this. So, the ways to get a Gda_Report object would be:
* through queryReports
* through addReport

so, we could either create the Gda_Report objects in these 2 parts via
gtk_type_new(gda_report_get_type())
and then set explicitly the CORBA_Object associated with the newly
created Gda_Report object, or
(better solution) have:

Gda_Report* gda_report_new (CORBA_Object corba_report);

so that you can only create a Gda_Report object from an exisitng
CORBA_Object, thus avoiding
unwanted calls to GDA_ReportEngine_addReport. Thus, this gda_report_new
call will be used both
in queryReports and addReport functions, which obtain a CORBA_Object
from the CORBA server, and then can call this function with that
CORBA_Object

> My doubt is... Is it correct? Must I move the GDA_ReportEngine_addRepor call to a separate
> method (gda_report_add)?
> 

yes, but to gda_report_engine_add_report

cheers





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