[Proj] C++ coding practices w.r.t object ownership
martin.desruisseaux at geomatys.com
Tue May 29 02:31:35 EST 2018
Le 27/05/2018 à 20:11, Even Rouault a écrit :
>> One quick comment: it may be worth to move CI_Citation, EX_Extent and
>> MD_Identifier, currently in "common", to their own "metadata" package.
> OK, done
I think that the "CI_", "EX_" and "MD_" prefixes can be omitted. They
duplicate namespaces/packages in C++/Java and recent ISO/TC211 policy
(in my understanding) is to drop them in newer standards. For example
"Datum" in ISO 19111:2018 was "CD_Datum" in ISO 19111:2007.
PositionalAccuracy (currently in "common" namespace) belong to
"metadata" namespace too.
Regarding the object ownership discussion, one more criterion that may
be worth to consider is whether the proposed alternatives support cyclic
references. For example ProjectedCRS.conversion references a Conversion
object, which could in turn reference back the ProjectedCRS in its
Conversion.targetCRS attribute. ISO 19111 allows to break this
circularity by allowing Conversion.source/targetCRS to be null in such
cases. But I find convenient to nevertheless provide the reference value
when the language/framework support cyclic references since it makes
easier to use a Conversion instance without carrying extra information
about its context. Circularity may also happen in ISO 19115 metadata,
e.g. between Platform and Instrument classes.
More information about the Proj