[geos-devel] Design of exception-trapping wrapper

Martin Davis mbdavis at VividSolutions.com
Fri Apr 11 20:35:56 EDT 2003


Sounds good to me then... press on!

Martin Davis, Senior Technical Architect
Vivid Solutions Inc.
Suite #1A-2328 Government Street   Victoria, B.C.   V8T 5G5
Phone: (250) 385 6040    Fax: (250) 385 6046
EMail: mbdavis at vividsolutions.com  Web: www.vividsolutions.com


> -----Original Message-----
> From: David Blasby [mailto:dblasby at refractions.net]
> Sent: Friday, April 11, 2003 5:33 PM
> To: GEOS Development List
> Subject: Re: [geos-devel] Design of exception-trapping wrapper
> 
> 
> Martin Davis wrote:
> 
> >Does anyone have time and ideas to prototype the design of 
> this wrapper?  I'm not sure I understand the problem quite 
> well enough yet to propose a design.   A small mockup might 
> help to clarify the situation.
> >
> Something like the function included below.
> NOTE: this is an *added* interface, not the ONLY interface.  C++ and 
> simple C programs could use the system exactly the way it is now.
> 
> We'd have to come up with name so we dont have any redundant symbols.
> 
>  >>This seems like a pretty substantial change to GEOS.
> 
> No - I think it would be pretty easy.  We could add another class to 
> GEOS.  It wouldnt even have to be compiled unless you're 
> using postgis...
> 
> Unfortunately, there could be a lot of these little 
> functions.  But, if 
> we stick to just wrapping the Geometry interface, we should 
> be okay.  I 
> dont think postgis requires more than this.
> 
> // call g1->contains(g2)
> // returns 0 = false
> //         1 = true
> //         2 = error was trapped
> char GEOSrelateContains(Geometry *g1, Geometry*g2)
> {
>    try {
>        bool result;
>        result = g1->contains(g2);
>        if (result)
>            return 1;
>        else
>            return 0;
>    }
>    catch (...)
>    {
>        return 2;
>    }
> }
> 
> The postgis_wrapper.cpp would be very simple:
> 
> char relate(Geometry *g1, Geometry *g2)
> {
>      return  GEOSrelateContains(g1,g2);
> }
> 
> 
> _______________________________________________
> geos-devel mailing list
> geos-devel at geos.refractions.net
> http://geos.refractions.net/mailman/listinfo/geos-devel
> 



More information about the geos-devel mailing list