You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by bu...@apache.org on 2003/03/13 07:51:30 UTC

DO NOT REPLY [Bug 17945] New: - Allow custom implementation of DOMNode interface to enable reference counting over nodes (and thus their early disposal)

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17945>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17945

Allow custom implementation of DOMNode interface to enable reference counting over nodes (and thus their early disposal)

           Summary: Allow custom implementation of DOMNode interface to
                    enable reference counting over nodes (and thus their
                    early disposal)
           Product: Xerces-C++
           Version: 2.1.0
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: DOM
        AssignedTo: xerces-c-dev@xml.apache.org
        ReportedBy: mbhatia@quark.co.in


This change will provide a custom implementer to know the lifetime of a node 
held by a client.  The client has to use  the DOMNodeSPtr type instead of a 
DOMNode* (respective DOMElementSPtr instead of DOMElement*) to automatically  
indicate the local usage.  If a node should have an extended life time, a 
DOMNodeSPtr can be used at the storage  location.  Note that this is an 
extension that does not require to be used.  This means, it�s an absolute low 
impact  extension.  This extension will allow a custom implementer to destroy 
nodes as they are not referenced anymore.  This  would also allow Xerces to 
support massive file-documents, since it can read as requested, and release 
memory as not  needed anymore.  This feature has been asked for several times 
in this list, and this extension would allow the Xerces  implementation to do 
that.

Changes:
1. Added 2 functions to DOMNode interface (with empty implementation), namely: 
		virtual void incRefCount() {}	and
		virtual void decRefCount() {}

This will be useful in a scenario when one is using xerces implementation and 
also implementing the DOMNode interface  himself and memory model of that 
custom implementation is different from xerces (eg. delete the node when you 
are done  with it). Implementing these functions will enable reference counting 
on DOMNodes and thus their disposal when one is  done with them. For a xerces 
node a call to these functions will do nothing while for a node element 
belonging to  custom implementation calling them will do reference counting on 
that element.

2. Introduce a smart pointer encapsulating DOMNode/DOMElement which takes care 
of reference counting automatically and  use it instead of DOMNode* or a 
DOMElement* at various places in xerces. To start with code for DOMWriterImpl 
class is  modified."

Please contact me, if you have any questions or doubt why that should be 
included.  My custom implementation needsthat  extension and I thought it might 
be 
useful for others.

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org