GncBusiness v. GNCSession

Linas Vepstas linas@linas.org
Fri, 23 Nov 2001 17:13:07 -0600


On Fri, Nov 23, 2001 at 05:27:29PM -0500, Derek Atkins was heard to remark:
> linas@linas.org (Linas Vepstas) writes:
> 
> > > > > I don't really care where the entity tables go, but if they're
> > > > > moving to books, then I'd like some help rewriting everything.
> > > > > That means fixing all of the API and all of the C & scheme code
> > > > > that now passes session arguments instead of books.
> > > > 
> > > > Ughh. But there are no other conceptual difficulties to making this
> > > > change, right?  
> > > 
> > > I don't see any, no.
> > 
> > If I magically discover I have some spare time (not likely, but..)
> > I will try to make this change 'real soon now'.
> 
> Are you implying that you will require an active GNCBook* in order
> to create any data structures?  

Yes, since all of the current top-level data structures are in
the book (the tree of accounts, the list of currencies, etc.)

> Does this mean that you can have
> an active GNCBook* even though it is not connected to a Backend*?

Yes -- in case someone just starts up a fresh copy of gnucash, enters
data, and hasn't hit 'save' yet.

> For the record, gnc_session_new() calls gnc_book_new() which implies
> that yes, there is always a GNCBook* sitting around, even though it is
> not connected to a Backend*.  I just wanted to make sure that we were
> going to make this explicit.

Right.

After the change, it will be legal (probably; I will not test) to
run gnucash with no active session.  (but I will not intientionally
make this so/break anything).   It might someday become possible
to have multiple sessions going for one book, although this has
certain conceptual problems ....

> I have no problem with the GNCEntityTable living in the GNCBook
> instead of the GNCSession.  In fact, I think I'd like to extend the
> GNCEntityTable to be able to handle arbitrary objects instead of the
> hardcoded list of types.

No objection, but lets look at the details...

> In particular, this means that we would need to change the GNCIdType
> enum and all the GNCEntity interfaces, or somehow be able to register
> new GNCIdTypes.  Personally I'd like to be able to use arbitrary
> strings, or better yet, have a separate GHashTable for each entity.
> Is there a preference?

Not at the moment.  I am *always* concerned about performance. 
--linas


-- 
pub  1024D/01045933 2001-02-01 Linas Vepstas (Labas!) <linas@linas.org>
PGP Key fingerprint = 8305 2521 6000 0B5E 8984  3F54 64A9 9A82 0104 5933