[xsde-users] Using auto_ptr for passing shared objects

Andrey Filimonov andrey.v.filimonov at gmail.com
Fri Nov 20 02:47:15 EST 2015


Hi Boris,
You're quite right, the reason why i use equivoques instead of direct
question in well defined context is that the question is hard to formulate
due to lack of context. As i said i'm trying to port a thing which is built
over XSD/Xerces to an embedded environment. The thing contains two layers -
syntactic based on XSD/Xerces and semantic. There is no proper insulation
between these two thus sematic layer is quite thoughly bound to code
produced by XSD. They widely used auto_ptr to get rid of explicit object
lifecycle management for the syntactic objects. They could do because
syntactic layer allowed them so, i.e. code, produced by XSD assumed you can
share lifecycle management responsibilities through autopointers.

With XSDe i have raw pointers, thus i have to define who is responsible for
creating and destroying objects. Adapting semantic layer to XSDe may be
tricky because object ownership isn't obvious at all. In the code not
taking care of object lifecycle it's hard to figure out who is owning and
who is responsible for what.

I have two potential ways out:
1) redesign semantic layer to clealy define ownership
2) if possible make code generated by XSDe rely on auto_ptr instead of raw
pointers to let current implementation of semantic layer keep its fuzzy
ownership.

Option 2 seem to cost much less, but from your last message i understood
that sharing objects the way can be done with XSD is not implementable with
XSDe. This reduces options list above to item 1.
I can put particular examples of differences between code produced by XSD
and XSDe, but i don't think they are relevant in this context.

Thanks for your explanations.

Best wishes,
Andrey.

2015-11-19 17:13 GMT+03:00 Boris Kolpackov <boris at codesynthesis.com>:

> Hi Andrey,
>
> Andrey Filimonov <andrey.v.filimonov at gmail.com> writes:
>
> > Is there a way to use typemaps in hybrid mode?
>
> The C++/Hybrid mapping uses type maps internally, since it provides
> the implementations of the parser/serializer skeletons. Why would
> you care whether C++/Hybrid uses raw pointers or auto_ptr internally?
>
> I think we are wasting time here with you trying to "hint" at what the
> problem is in one-two sentences and me trying to guess what you meant.
> I suggest that you show a concrete code fragment and point to what
> exactly causes you problems.
>
> Boris
>


More information about the xsde-users mailing list