[Proj] C++ coding practices w.r.t object ownership
martin.desruisseaux at geomatys.com
Tue May 29 08:01:41 EST 2018
Le 29/05/2018 à 14:28, Even Rouault a écrit :
> Another main reason is that the UML modelling from which this is
> derived from has probably be done with Java in mind as an
> implementation target. So shared pointers are the closest tool we have
> to emulate Java garbage collection.
Actually the design is a little bit more abstract. Normally (unless we
did a mistake in the model), there is no requirement to use a garbage
collector or not; the choice is up to implementer. ISO 19111 allows
implementations without garbage collector by allowing some pointers to
be null, for breaking cycles. For example, on a conceptual point of view
Conversion.source/targetCRS should never be null. But in practice ISO
19111 nevertheless declares those associations as optional for
implementers who want to avoid cycles between Conversion and ProjectedCRS.
So the choice for PROJ may be:
* Avoid cycles as allowed by ISO 19111, at the cost of some
inconveniences (e.g. usages of Conversion objects may require more
* More convenient Conversion objects, at the cost of cyclic references.
ProjectedCRS ⇋ Conversion is the main potential cycle I'm aware of.
There may be another one in the new classes related to point motions or
vertical transformations, but I'm not sure (I'm not yet familiar enough
with that new part).
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Proj