[ZOOM] Object Owenership (Was: Value Returned from Set Option (Was: Catching up))

Adam Dickmeiss adam at indexdata.dk
Mon Nov 19 11:04:26 CET 2001


On Mon, Nov 19, 2001 at 09:41:19AM +0000, Ashley Sanders wrote:
> Adam,
> 
> > const record &resultSet::getRecordR (size_t pos) const
> > {
> >     derivedRecord *r = 0;  // get if from a cache, whatever..
> > 
> >     return *r; 
> > }
> 
> The above is the crux of the matter. Maybe I've missed something,
> and if so my apologies, but if we aren't having a record to represent
> that the origin wasn't able to retrieve a record, but instead got
> a surrogate diagnostic, then we just can't do the above. If we
> use references then we have to return a record. Using references
> does away with the memory leaks, but we would need to define
> something like a nullRecord so that getRecord() can always return
> something. (And I'm not keen on the idea of getRecord() throwing
> an exception instead.) nullRecord could just be defined something
> like:
> 
> class nullRecord : public record {
>     recordSyntax recsyn () { return ??????; };
>     size_t nfields () { return 0; };
>     const char *field (const char *spec) { return ""; };
>     const char *render () { return ""; };
>     const char *rawdata () { return ""; };
> }
> 
> I'd be happy with references and an error/null record something
> like the above.

Ashley,

I can see the problem. The idea of treating Surrogate Diagnostics
as records sounds like a good idea to me. And for API users
that are satisfied with "render" only, it's an easy route to
get something *robust* up'n running fast.

> Ashley.
> 
> -- 
> Ashley Sanders                                a.sanders at mcc.ac.uk
> COPAC: A public bibliographic database from MIMAS, funded by JISC
>              http://copac.ac.uk/ - copac at mimas.ac.uk
> _______________________________________________
> ZOOM mailing list
> ZOOM at indexdata.dk
> http://www.indexdata.dk/mailman/listinfo/zoom

-- 
Adam Dickmeiss  mailto:adam at indexdata.dk  http://www.indexdata.dk
Index Data      T: +45 33410100           Mob.: 212 212 66



More information about the ZOOM mailing list