@@ -19,16 +19,11 @@ under the License.
1919%module fesapi
2020%feature(" python:annotations" , " c" );
2121
22- %{
23- #if defined(__clang__) || defined(_MSC_VER)
24- #elif defined(__GNUC__) || defined(__GNUG__)
25- #pragma GCC diagnostic ignored "-Wcast-qual"
26- #pragma GCC diagnostic ignored "-Wstrict-aliasing"
27- #endif
28- %}
29-
3022%include " stdint.i"
3123%include " std_string.i"
24+ #if SWIG_VERSION >= 0x040100
25+ %include <std_unique_ptr.i>
26+ #endif
3227
3328%include " ../src/nsDefinitions.h"
3429
@@ -94,13 +89,15 @@ under the License.
9489 SWIG_CSBODY_PROXY (public, public, SWIGTYPE)
9590 SWIG_CSBODY_TYPEWRAPPER(public, public, public, SWIGTYPE)
9691
92+ #if SWIG_VERSION < 0x040100
9793%typemap(cscode) COMMON_NS::DataObjectRepository %{
9894 private HdfProxyFactory hdfProxyFactoryReference = null;
9995%}
10096
10197%typemap(csin,
10298 post =" hdfProxyFactoryReference = $csinput;"
10399 ) COMMON_NS::HdfProxyFactory * factory " HdfProxyFactory.getCPtr($csinput)"
100+ #endif
104101
105102 %include " swigCsInclude.i"
106103#endif
@@ -116,6 +113,7 @@ under the License.
116113 %}
117114 %include " swigPythonInclude.i"
118115
116+ #if SWIG_VERSION < 0x040100
119117 /* Following extensions aims at preventing the Python garbage collector from
120118 garbage collecting an HDF Proxy factory that may be still used by a repository. */
121119 %fragment(" hdf_proxy_factory_reference_init" , " init" ) {
@@ -133,6 +131,7 @@ under the License.
133131 %}
134132 }
135133#endif
134+ #endif
136135
137136
138137// ************************/
@@ -220,6 +219,7 @@ namespace EML2_NS
220219%module (directors=" 1" ) fesapi
221220%feature(" director" ) COMMON_NS::HdfProxyFactory;
222221
222+ #if SWIG_VERSION < 0x040100
223223/*
224224Following csbody and javabody typemap definitions force the target language to not
225225manage the memory of the C++ part of wrapped COMMON_NS::HdfProxyFactory and
@@ -254,6 +254,7 @@ destructor).
254254 return (obj == null) ? 0 : obj.swigCPtr ;
255255 }
256256%}
257+ #endif
257258
258259/*
259260AbstractHdfProxy may be inherited in target languages. In such case, overriding
@@ -276,6 +277,10 @@ warning (205) during the Swig processing.
276277 return (obj == null) ? new global::System.Runtime .InteropServices .HandleRef (null, global::System.IntPtr .Zero ) : obj.swigCPtr ;
277278 }
278279%}
280+
281+ #if SWIG_VERSION >= 0x040100
282+ %unique_ptr(COMMON_NS::HdfProxyFactory)
283+ #endif
279284namespace COMMON_NS
280285{
281286 %nodefaultctor; // Disable creation of default constructors
@@ -917,6 +922,7 @@ import java.lang.AutoCloseable;
917922import com.f2i_consulting .fesapi .*;
918923%}
919924%typemap(javainterfaces) COMMON_NS::DataObjectRepository " AutoCloseable"
925+ #if SWIG_VERSION < 0x040100
920926%typemap(javacode) COMMON_NS::DataObjectRepository %{
921927 private HdfProxyFactory hdfProxyFactoryReference;
922928
@@ -929,7 +935,15 @@ import com.f2i_consulting.fesapi.*;
929935%typemap(javain,
930936 post =" hdfProxyFactoryReference = $javainput;"
931937 ) COMMON_NS::HdfProxyFactory * factory " HdfProxyFactory.getCPtr($javainput)"
932-
938+ #else
939+ %typemap(javacode) COMMON_NS::DataObjectRepository %{
940+ @Override
941+ public void close () {
942+ clear ();
943+ delete ();
944+ }
945+ %}
946+ #endif
933947 /* *
934948 * @brief A DataObjectRepository stores in memory all dataObjects.
935949 * This is the in-memory container which holds deserialized (EPC) files and fetched ETP dataobjects.
@@ -1039,13 +1053,23 @@ import com.f2i_consulting.fesapi.*;
10391053 * @param[in] hdfProxy If non-null, the HDF5 file proxy.
10401054 */
10411055 void setDefaultHdfProxy (EML2_NS::AbstractHdfProxy* hdfProxy);
1042-
1056+
1057+ #if SWIG_VERSION >= 0x040100
1058+ /* *
1059+ * Set the factory used to create HDF proxy and takes ownership of this HDF Proxy factory (don't use it after having called this method!)
1060+ *
1061+ * @param[in] factory If non-null, the factory.
1062+ */
1063+ void setHdfProxyFactory (std::unique_ptr<COMMON_NS::HdfProxyFactory> factory);
1064+ #else
10431065 /* *
1044- * Set the factory used to create HDF proxy and takes ownership of this HDF Proxy factory (don't delete it!)
1066+ * Set the factory used to create HDF proxy and takes ownership of this HDF Proxy factory.
1067+ * Don't delete it! Do not allow gabage to collect it. Disown it from Swig since it will be destroyed by the C++ layer anyhow.
10451068 *
10461069 * @param[in] factory If non-null, the factory.
10471070 */
1048- void setHdfProxyFactory (COMMON_NS::HdfProxyFactory * factory);
1071+ void setHdfProxyFactory (COMMON_NS::HdfProxyFactory* factory);
1072+ #endif
10491073
10501074 /* *
10511075 * Adds or replaces (based on Energistics XML definition) a data object in the repository. It
0 commit comments