QOF and child objects

Derek Atkins warlord at MIT.EDU
Tue May 3 11:21:40 EDT 2005

Quoting Neil Williams <linux at codehelp.co.uk>:
> Is it OK to replace:
> { QOF_PARAM_GUID, QOF_TYPE_GUID,   (QofAccessFunc)gncOwnerGetGUID, NULL },
> with
> { QOF_PARAM_GUID, QOF_TYPE_GUID, (QofAccessFunc)qof_instance_get_guid, NULL
> },
> in GncOwner.c?
> (Now that I've got a QofInstance in GncOwner)
> That's the only change that has to replace what already exists - is it likely
> to break anything else, like any of the Find procedures for Customers or 
> Invoices etc?

Yes, it's likely to break a LOT of places!  You should grep through the code,
but it's going to cause no end to grief in a lot of places (including the
reports, which makes grepping a bit more challenging).

It's too bad you can't "special-case" objects in QOF.  The GncOwner REALLY is
just a placeholder, a way to store one of a set of types.  Perhaps instead of
trying to fit GncOwner into QOF, we should change QOF to handle superclass
storage types like GncOwner?  Would that make more sense?

Frankly I really see no reason to turn a GncOwner into a full fledged object. 
That's REALLY stupid, IMHO.  There's no reason to make a table out of them,
either, because all the information in GncOwner _already exists_.  Effectively
GncOwner is just a QofEntity with a limited range of values.  So perhaps the
right way to fix this is make a QofLimitedEntity type that has a limit of the
types of objects and have QoF treat the LimitedEntity as a special type in the
I/O routines?  Then we can recode GncOwner as a
QofLimitedEntity<Customer,Vendor,Employee> (to use a C++ term).

> The rest of the changes can be internal to the object and not affect existing
> functions.

Unfortunately a lot of code assumes it can get the actual underlying guid from
that API.  I'd have to do a LOT of research to figure out where, but a number
of searchparams use that API (both in C and Scheme).


       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord at MIT.EDU                        PGP key available

More information about the gnucash-devel mailing list