Hi Joseph,
Interestingly, the reason I proposed a handle/body approach in the first
place is that I am trying to do just that "plugging other DOM
implementations into the same applications", but while the abstract base
classes IDOM provides are perfect for specifying the interfaces that all
implementations must meet, they are not ideal as the user interface. The
reason is evident from thus sample from the current IDOM interface:
virtual IDOM_Node *getFirstChild() const = 0;
The implementation has no idea how long a the returned child is in use,
because it is being returned as a raw pointer. For some implementations not
knowing how long a node is in use is not a problem, most likely because they
keep all of a document's node in memory so long as the document is alive.
For other implementations, though, it is essential to know how long a node
is in use so that it can be placed onto disk, compressed, or whatever.
Now consider the original DOM interface:
DOM_Node getFirstChild() const;
The DOM_Node object is returned not by pointer, but as a lightweight object
that wraps some implementation object that inherits from IDOM_Node, a pure
abstract base interface. The DOM_Node calls addRef on the IDOM_Node
implementation object (some object of a class inheriting from IDOM_Node).
When the DOM_Node object goes out of scope, it calls removeRef on the
IDOM_Node implementation object. Using reference counting, implementations
can then know how long a node is in use.
So if your interest is in pluggable implementations, then I would expect
that you would prefer the handle body approach. The handles are the
original DOM interface classes, and the bodies are specified as the abstract
classes from the IDOM. As with IDOM alone, Different implementations are
created by deriving from the abstract base classes, but by also using the
lightweight handles, they are not restricted to a particular memory model.
I have fixed the IDOM memory leak using this knowledge, and I am not sure
how to do it otherwise. So the handles are necessary to actually make truly
realize the IDOM performance benefit.
Lenny
-----Original Message-----
From: Joseph Kesselman/CAM/Lotus [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 29, 2002 10:17 AM
To: [EMAIL PROTECTED]
Subject: Re: Call for Vote: which one to be the Xerces-C++ public
supported W3C DOM interface
By the way, the abstract base class is a _HUGE_ plus for the IDOM approach.
It would allow plugging other DOM implementations into the same
applications, allowing programmers to access DOMs specialized for
particular tasks, eg wrapped around other data structures.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]