"Lenny Hoffman" <[EMAIL PROTECTED]> writes:
> Am I missing something here?
Probably, not ;-)
It's usually my lack of C++ knowledge.
> > To track the underlying C++ objects, Xerces-Perl keeps a pointer
> > to the object, so all my method calls will be pointer invocations.
>
> I don't understand what the problem is. You can continue to keep a pointer,
> or you can keep a smart pointer.
The issue is what I would need to do to keep a smart pointer.
I use SWIG to generate all my wrapper code - so in some sense I am
constrained by how SWIG generates wrappers. Let's for a moment forget
this, and say I was doing it by hand.
If my wrapper code generated smart pointers like so:
some_wrapper_method ()
{
DOM_Element element = ...;
SV *perl_object = perl_sv_setref_pv('DOM_Element', &element);
... // return perl_object
}
how will the smart pointer know that it hasn't gone out of scope and
release itself automatically, thus leaving me with a bad pointer?
> I thought you said you currently support the IDOM. If you are happy with
> that, then all you need to do is renamed IDOM_* to DOM*.
already done.
> You don't have to use the smart pointer handles if you don't want
> the benefit of automatic calls to release, either because you will
> be explicitly calling release when needed or you don't care about
> memory growth.
;-)
Believe me I would like automatic memory release, I'm just at a loss
to figure out how I can get to it. It seems I will *have* to force
users to explicitly call release(), and that will mean the Xerces-C
DOM API has functionality not replicated in Xerces-Perl, which is
likely to lead to user confusion for me.
> If you did decide to gain the benefit of handles, then their being
> smart pointers would mean fewer updates for you, not more, as the
> handles as smart pointers act quite a bit like the raw pointers you
> are using today.
If you can help me understand how to use them, then I will be very
happy.
Pardon my denseness,
jas.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]