@@ -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,19 +922,22 @@ import java.lang.AutoCloseable;
917922import com.f2i_consulting .fesapi .*;
918923%}
919924%typemap(javainterfaces) COMMON_NS::DataObjectRepository " AutoCloseable"
920- %typemap(javacode) COMMON_NS::DataObjectRepository %{
921- private HdfProxyFactory hdfProxyFactoryReference;
922-
925+ %typemap(javacode) COMMON_NS::DataObjectRepository %{
923926 @Override
924927 public void close () {
925928 clear ();
926929 delete ();
927930 }
928931%}
932+
933+ #if SWIG_VERSION < 0x040100
934+ %typemap(javacode) COMMON_NS::DataObjectRepository %{
935+ private HdfProxyFactory hdfProxyFactoryReference;
936+ %}
929937%typemap(javain,
930938 post =" hdfProxyFactoryReference = $javainput;"
931939 ) COMMON_NS::HdfProxyFactory * factory " HdfProxyFactory.getCPtr($javainput)"
932-
940+ # endif
933941 /* *
934942 * @brief A DataObjectRepository stores in memory all dataObjects.
935943 * This is the in-memory container which holds deserialized (EPC) files and fetched ETP dataobjects.
@@ -1039,13 +1047,23 @@ import com.f2i_consulting.fesapi.*;
10391047 * @param[in] hdfProxy If non-null, the HDF5 file proxy.
10401048 */
10411049 void setDefaultHdfProxy (EML2_NS::AbstractHdfProxy* hdfProxy);
1042-
1050+
1051+ #if SWIG_VERSION >= 0x040100
1052+ /* *
1053+ * 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!)
1054+ *
1055+ * @param[in] factory If non-null, the factory.
1056+ */
1057+ void setHdfProxyFactory (std::unique_ptr<COMMON_NS::HdfProxyFactory> factory);
1058+ #else
10431059 /* *
1044- * Set the factory used to create HDF proxy and takes ownership of this HDF Proxy factory (don't delete it!)
1060+ * Set the factory used to create HDF proxy and takes ownership of this HDF Proxy factory.
1061+ * 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.
10451062 *
10461063 * @param[in] factory If non-null, the factory.
10471064 */
1048- void setHdfProxyFactory (COMMON_NS::HdfProxyFactory * factory);
1065+ void setHdfProxyFactory (COMMON_NS::HdfProxyFactory* factory);
1066+ #endif
10491067
10501068 /* *
10511069 * Adds or replaces (based on Energistics XML definition) a data object in the repository. It
0 commit comments