diff --git a/Base/Axis/Frame.cpp b/Base/Axis/Frame.cpp index 61755fdb09abab30daa699d5078c94f90f369590..2025886c2b9175a8477b7c5289dc0bbc1514e068 100644 --- a/Base/Axis/Frame.cpp +++ b/Base/Axis/Frame.cpp @@ -17,8 +17,8 @@ #include "Base/Axis/Scale.h" #include "Base/Util/Assert.h" -Frame::Frame(const std::vector<const Scale*>& axes) - : m_axes(axes) +Frame::Frame(std::vector<const Scale*> axes) + : m_axes(std::move(axes)) , m_size(FrameUtil::product_size(m_axes.reference())) { } diff --git a/Base/Axis/Frame.h b/Base/Axis/Frame.h index 879b45e0e3ead9361d7428db8de08b9dbee9b545..d8f8ae4d0f66ad8a7bdc5c0007804ee4145dbf8d 100644 --- a/Base/Axis/Frame.h +++ b/Base/Axis/Frame.h @@ -27,7 +27,7 @@ class Scale; class Frame { public: //! Constructor that takes ownership of supplied axes. - Frame(const std::vector<const Scale*>& axes); + Frame(std::vector<const Scale*> axes); Frame(const Scale* ax0); Frame(const Scale* ax0, const Scale* ax1); diff --git a/Device/Data/Datafield.cpp b/Device/Data/Datafield.cpp index 6b43474c786f41442788ecaa20a0db3a3974b862..1f83491687008fe9c97050e3b81187aec5839e31 100644 --- a/Device/Data/Datafield.cpp +++ b/Device/Data/Datafield.cpp @@ -35,7 +35,7 @@ Datafield::Datafield(const Frame* frame, std::vector<double> values, std::vector { } -Datafield::Datafield(std::vector<const Scale*>&& axes, std::vector<double> values, +Datafield::Datafield(std::vector<const Scale*> axes, std::vector<double> values, std::vector<double> errSigmas) : Datafield("", new Frame(std::move(axes)), values, errSigmas) { diff --git a/Device/Data/Datafield.h b/Device/Data/Datafield.h index 6af6bcdc64479af8a2969bfdb9a610d41f16066e..45873edb6a5ee1b36746b1c61bfb11066ab6d95b 100644 --- a/Device/Data/Datafield.h +++ b/Device/Data/Datafield.h @@ -38,7 +38,7 @@ public: std::vector<double> errSigmas = {}); //! Constructor that takes ownership of supplied axes and initializes values and errorbars - Datafield(std::vector<const Scale*>&& axes, std::vector<double> values = {}, + Datafield(std::vector<const Scale*> axes, std::vector<double> values = {}, std::vector<double> errSigmas = {}); Datafield(const Datafield&); diff --git a/auto/Wrap/libBornAgainBase.py b/auto/Wrap/libBornAgainBase.py index d78ef674e870562b9db11118ac43cd082190505e..7d8c6f297a6da3c114da9bd4fe7234a1fa5c1d30 100644 --- a/auto/Wrap/libBornAgainBase.py +++ b/auto/Wrap/libBornAgainBase.py @@ -1976,7 +1976,7 @@ class Frame(object): def __init__(self, *args): r""" - __init__(Frame self, std::vector< Scale const *,std::allocator< Scale const * > > const & axes) -> Frame + __init__(Frame self, std::vector< Scale const *,std::allocator< Scale const * > > axes) -> Frame __init__(Frame self, Scale ax0) -> Frame __init__(Frame self, Scale ax0, Scale ax1) -> Frame """ diff --git a/auto/Wrap/libBornAgainBase_wrap.cpp b/auto/Wrap/libBornAgainBase_wrap.cpp index 41d0e89ed6035ff861bdbc735c117e2befbc3a0b..2ae9aa8c82c5e3453b84efa10edc60990e18bb4d 100644 --- a/auto/Wrap/libBornAgainBase_wrap.cpp +++ b/auto/Wrap/libBornAgainBase_wrap.cpp @@ -26965,23 +26965,28 @@ fail: SWIGINTERN PyObject *_wrap_new_Frame__SWIG_0(PyObject *self, Py_ssize_t nobjs, PyObject **swig_obj) { PyObject *resultobj = 0; - std::vector< Scale const *,std::allocator< Scale const * > > *arg1 = 0 ; - void *argp1 = 0 ; + SwigValueWrapper< std::vector< Scale const *,std::allocator< Scale const * > > > arg1 ; + void *argp1 ; int res1 = 0 ; Frame *result = 0 ; if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_std__vectorT_Scale_const_p_std__allocatorT_Scale_const_p_t_t, 0 | 0); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Frame" "', argument " "1"" of type '" "std::vector< Scale const *,std::allocator< Scale const * > > const &""'"); - } - if (!argp1) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_Frame" "', argument " "1"" of type '" "std::vector< Scale const *,std::allocator< Scale const * > > const &""'"); + { + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_std__vectorT_Scale_const_p_std__allocatorT_Scale_const_p_t_t, 0 | 0); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Frame" "', argument " "1"" of type '" "std::vector< Scale const *,std::allocator< Scale const * > >""'"); + } + if (!argp1) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_Frame" "', argument " "1"" of type '" "std::vector< Scale const *,std::allocator< Scale const * > >""'"); + } else { + std::vector< Scale const *,std::allocator< Scale const * > > * temp = reinterpret_cast< std::vector< Scale const *,std::allocator< Scale const * > > * >(argp1); + arg1 = *temp; + if (SWIG_IsNewObj(res1)) delete temp; + } } - arg1 = reinterpret_cast< std::vector< Scale const *,std::allocator< Scale const * > > * >(argp1); { try { - result = (Frame *)new Frame((std::vector< Scale const *,std::allocator< Scale const * > > const &)*arg1); + result = (Frame *)new Frame(arg1); } catch (const std::exception& ex) { // message shown in the Python interpreter const std::string msg { @@ -27110,7 +27115,7 @@ SWIGINTERN PyObject *_wrap_new_Frame(PyObject *self, PyObject *args) { fail: SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'new_Frame'.\n" " Possible C/C++ prototypes are:\n" - " Frame::Frame(std::vector< Scale const *,std::allocator< Scale const * > > const &)\n" + " Frame::Frame(std::vector< Scale const *,std::allocator< Scale const * > >)\n" " Frame::Frame(Scale const *)\n" " Frame::Frame(Scale const *,Scale const *)\n"); return 0; @@ -30306,7 +30311,7 @@ static PyMethodDef SwigMethods[] = { { "EquiDivision", _wrap_EquiDivision, METH_VARARGS, "EquiDivision(std::string name, size_t N, double start, double end) -> Scale"}, { "EquiScan", _wrap_EquiScan, METH_VARARGS, "EquiScan(std::string name, size_t N, double start, double end) -> Scale"}, { "new_Frame", _wrap_new_Frame, METH_VARARGS, "\n" - "Frame(std::vector< Scale const *,std::allocator< Scale const * > > const & axes)\n" + "Frame(std::vector< Scale const *,std::allocator< Scale const * > > axes)\n" "Frame(Scale ax0)\n" "new_Frame(Scale ax0, Scale ax1) -> Frame\n" ""}, diff --git a/auto/Wrap/libBornAgainDevice.py b/auto/Wrap/libBornAgainDevice.py index c7171461e374348fb51efd0a1888be4ea992039a..458605b1b58b9e53986216a703f6468b3b023519 100644 --- a/auto/Wrap/libBornAgainDevice.py +++ b/auto/Wrap/libBornAgainDevice.py @@ -2066,7 +2066,7 @@ class Datafield(object): r""" __init__(Datafield self, std::string title, Frame frame, vdouble1d_t values={}, vdouble1d_t errSigmas={}) -> Datafield __init__(Datafield self, Frame frame, vdouble1d_t values={}, vdouble1d_t errSigmas={}) -> Datafield - __init__(Datafield self, std::vector< Scale const *,std::allocator< Scale const * > > && axes, vdouble1d_t values={}, vdouble1d_t errSigmas={}) -> Datafield + __init__(Datafield self, std::vector< Scale const *,std::allocator< Scale const * > > axes, vdouble1d_t values={}, vdouble1d_t errSigmas={}) -> Datafield __init__(Datafield self, Datafield arg2) -> Datafield __init__(Datafield self, Datafield arg2) -> Datafield """ diff --git a/auto/Wrap/libBornAgainDevice_wrap.cpp b/auto/Wrap/libBornAgainDevice_wrap.cpp index 8239dd21f387e6ab9b1b4203589274da469be07f..ac3a2158b44a1e46a13ad577e5dcc175bcfd7e02 100644 --- a/auto/Wrap/libBornAgainDevice_wrap.cpp +++ b/auto/Wrap/libBornAgainDevice_wrap.cpp @@ -29170,28 +29170,27 @@ fail: SWIGINTERN PyObject *_wrap_new_Datafield__SWIG_6(PyObject *self, Py_ssize_t nobjs, PyObject **swig_obj) { PyObject *resultobj = 0; - std::vector< Scale const *,std::allocator< Scale const * > > *arg1 = 0 ; + SwigValueWrapper< std::vector< Scale const *,std::allocator< Scale const * > > > arg1 ; std::vector< double,std::allocator< double > > arg2 ; std::vector< double,std::allocator< double > > arg3 ; - void *argp1 = 0 ; + void *argp1 ; int res1 = 0 ; - std::unique_ptr< std::vector< Scale const *,std::allocator< Scale const * > > > rvrdeleter1 ; Datafield *result = 0 ; if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_std__vectorT_Scale_const_p_std__allocatorT_Scale_const_p_t_t, SWIG_POINTER_RELEASE | 0 ); - if (!SWIG_IsOK(res1)) { - if (res1 == SWIG_ERROR_RELEASE_NOT_OWNED) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Datafield" "', cannot release ownership as memory is not owned for argument " "1"" of type '" "std::vector< Scale const *,std::allocator< Scale const * > > &&""'"); + { + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_std__vectorT_Scale_const_p_std__allocatorT_Scale_const_p_t_t, 0 | 0); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Datafield" "', argument " "1"" of type '" "std::vector< Scale const *,std::allocator< Scale const * > >""'"); + } + if (!argp1) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_Datafield" "', argument " "1"" of type '" "std::vector< Scale const *,std::allocator< Scale const * > >""'"); } else { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Datafield" "', argument " "1"" of type '" "std::vector< Scale const *,std::allocator< Scale const * > > &&""'"); + std::vector< Scale const *,std::allocator< Scale const * > > * temp = reinterpret_cast< std::vector< Scale const *,std::allocator< Scale const * > > * >(argp1); + arg1 = *temp; + if (SWIG_IsNewObj(res1)) delete temp; } } - if (!argp1) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_Datafield" "', argument " "1"" of type '" "std::vector< Scale const *,std::allocator< Scale const * > > &&""'"); - } - arg1 = reinterpret_cast< std::vector< Scale const *,std::allocator< Scale const * > > * >(argp1); - rvrdeleter1.reset(arg1); { std::vector< double,std::allocator< double > > *ptr = (std::vector< double,std::allocator< double > > *)0; int res = swig::asptr(swig_obj[1], &ptr); @@ -29212,7 +29211,7 @@ SWIGINTERN PyObject *_wrap_new_Datafield__SWIG_6(PyObject *self, Py_ssize_t nobj } { try { - result = (Datafield *)new Datafield((std::vector< Scale const *,std::allocator< Scale const * > > &&)*arg1,arg2,arg3); + result = (Datafield *)new Datafield(arg1,arg2,arg3); } catch (const std::exception& ex) { // message shown in the Python interpreter const std::string msg { @@ -29230,27 +29229,26 @@ fail: SWIGINTERN PyObject *_wrap_new_Datafield__SWIG_7(PyObject *self, Py_ssize_t nobjs, PyObject **swig_obj) { PyObject *resultobj = 0; - std::vector< Scale const *,std::allocator< Scale const * > > *arg1 = 0 ; + SwigValueWrapper< std::vector< Scale const *,std::allocator< Scale const * > > > arg1 ; std::vector< double,std::allocator< double > > arg2 ; - void *argp1 = 0 ; + void *argp1 ; int res1 = 0 ; - std::unique_ptr< std::vector< Scale const *,std::allocator< Scale const * > > > rvrdeleter1 ; Datafield *result = 0 ; if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_std__vectorT_Scale_const_p_std__allocatorT_Scale_const_p_t_t, SWIG_POINTER_RELEASE | 0 ); - if (!SWIG_IsOK(res1)) { - if (res1 == SWIG_ERROR_RELEASE_NOT_OWNED) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Datafield" "', cannot release ownership as memory is not owned for argument " "1"" of type '" "std::vector< Scale const *,std::allocator< Scale const * > > &&""'"); + { + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_std__vectorT_Scale_const_p_std__allocatorT_Scale_const_p_t_t, 0 | 0); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Datafield" "', argument " "1"" of type '" "std::vector< Scale const *,std::allocator< Scale const * > >""'"); + } + if (!argp1) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_Datafield" "', argument " "1"" of type '" "std::vector< Scale const *,std::allocator< Scale const * > >""'"); } else { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Datafield" "', argument " "1"" of type '" "std::vector< Scale const *,std::allocator< Scale const * > > &&""'"); + std::vector< Scale const *,std::allocator< Scale const * > > * temp = reinterpret_cast< std::vector< Scale const *,std::allocator< Scale const * > > * >(argp1); + arg1 = *temp; + if (SWIG_IsNewObj(res1)) delete temp; } } - if (!argp1) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_Datafield" "', argument " "1"" of type '" "std::vector< Scale const *,std::allocator< Scale const * > > &&""'"); - } - arg1 = reinterpret_cast< std::vector< Scale const *,std::allocator< Scale const * > > * >(argp1); - rvrdeleter1.reset(arg1); { std::vector< double,std::allocator< double > > *ptr = (std::vector< double,std::allocator< double > > *)0; int res = swig::asptr(swig_obj[1], &ptr); @@ -29262,7 +29260,7 @@ SWIGINTERN PyObject *_wrap_new_Datafield__SWIG_7(PyObject *self, Py_ssize_t nobj } { try { - result = (Datafield *)new Datafield((std::vector< Scale const *,std::allocator< Scale const * > > &&)*arg1,arg2); + result = (Datafield *)new Datafield(arg1,arg2); } catch (const std::exception& ex) { // message shown in the Python interpreter const std::string msg { @@ -29280,29 +29278,28 @@ fail: SWIGINTERN PyObject *_wrap_new_Datafield__SWIG_8(PyObject *self, Py_ssize_t nobjs, PyObject **swig_obj) { PyObject *resultobj = 0; - std::vector< Scale const *,std::allocator< Scale const * > > *arg1 = 0 ; - void *argp1 = 0 ; + SwigValueWrapper< std::vector< Scale const *,std::allocator< Scale const * > > > arg1 ; + void *argp1 ; int res1 = 0 ; - std::unique_ptr< std::vector< Scale const *,std::allocator< Scale const * > > > rvrdeleter1 ; Datafield *result = 0 ; if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_std__vectorT_Scale_const_p_std__allocatorT_Scale_const_p_t_t, SWIG_POINTER_RELEASE | 0 ); - if (!SWIG_IsOK(res1)) { - if (res1 == SWIG_ERROR_RELEASE_NOT_OWNED) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Datafield" "', cannot release ownership as memory is not owned for argument " "1"" of type '" "std::vector< Scale const *,std::allocator< Scale const * > > &&""'"); + { + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_std__vectorT_Scale_const_p_std__allocatorT_Scale_const_p_t_t, 0 | 0); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Datafield" "', argument " "1"" of type '" "std::vector< Scale const *,std::allocator< Scale const * > >""'"); + } + if (!argp1) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_Datafield" "', argument " "1"" of type '" "std::vector< Scale const *,std::allocator< Scale const * > >""'"); } else { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Datafield" "', argument " "1"" of type '" "std::vector< Scale const *,std::allocator< Scale const * > > &&""'"); + std::vector< Scale const *,std::allocator< Scale const * > > * temp = reinterpret_cast< std::vector< Scale const *,std::allocator< Scale const * > > * >(argp1); + arg1 = *temp; + if (SWIG_IsNewObj(res1)) delete temp; } } - if (!argp1) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_Datafield" "', argument " "1"" of type '" "std::vector< Scale const *,std::allocator< Scale const * > > &&""'"); - } - arg1 = reinterpret_cast< std::vector< Scale const *,std::allocator< Scale const * > > * >(argp1); - rvrdeleter1.reset(arg1); { try { - result = (Datafield *)new Datafield((std::vector< Scale const *,std::allocator< Scale const * > > &&)*arg1); + result = (Datafield *)new Datafield(arg1); } catch (const std::exception& ex) { // message shown in the Python interpreter const std::string msg { @@ -29411,8 +29408,7 @@ SWIGINTERN PyObject *_wrap_new_Datafield(PyObject *self, PyObject *args) { } if (argc == 1) { int _v = 0; - void *vptr = 0; - int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_std__vectorT_Scale_const_p_std__allocatorT_Scale_const_p_t_t, SWIG_POINTER_NO_NULL); + int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_std__vectorT_Scale_const_p_std__allocatorT_Scale_const_p_t_t, SWIG_POINTER_NO_NULL | 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_new_Datafield__SWIG_8(self, argc, argv); @@ -29450,8 +29446,7 @@ SWIGINTERN PyObject *_wrap_new_Datafield(PyObject *self, PyObject *args) { } if (argc == 2) { int _v = 0; - void *vptr = 0; - int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_std__vectorT_Scale_const_p_std__allocatorT_Scale_const_p_t_t, SWIG_POINTER_NO_NULL); + int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_std__vectorT_Scale_const_p_std__allocatorT_Scale_const_p_t_t, SWIG_POINTER_NO_NULL | 0); _v = SWIG_CheckState(res); if (_v) { int res = swig::asptr(argv[1], (std::vector< double,std::allocator< double > >**)(0)); @@ -29493,8 +29488,7 @@ SWIGINTERN PyObject *_wrap_new_Datafield(PyObject *self, PyObject *args) { } if (argc == 3) { int _v = 0; - void *vptr = 0; - int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_std__vectorT_Scale_const_p_std__allocatorT_Scale_const_p_t_t, SWIG_POINTER_NO_NULL); + int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_std__vectorT_Scale_const_p_std__allocatorT_Scale_const_p_t_t, SWIG_POINTER_NO_NULL | 0); _v = SWIG_CheckState(res); if (_v) { int res = swig::asptr(argv[1], (std::vector< double,std::allocator< double > >**)(0)); @@ -29556,9 +29550,9 @@ fail: " Datafield::Datafield(Frame const *,std::vector< double,std::allocator< double > >,std::vector< double,std::allocator< double > >)\n" " Datafield::Datafield(Frame const *,std::vector< double,std::allocator< double > >)\n" " Datafield::Datafield(Frame const *)\n" - " Datafield::Datafield(std::vector< Scale const *,std::allocator< Scale const * > > &&,std::vector< double,std::allocator< double > >,std::vector< double,std::allocator< double > >)\n" - " Datafield::Datafield(std::vector< Scale const *,std::allocator< Scale const * > > &&,std::vector< double,std::allocator< double > >)\n" - " Datafield::Datafield(std::vector< Scale const *,std::allocator< Scale const * > > &&)\n" + " Datafield::Datafield(std::vector< Scale const *,std::allocator< Scale const * > >,std::vector< double,std::allocator< double > >,std::vector< double,std::allocator< double > >)\n" + " Datafield::Datafield(std::vector< Scale const *,std::allocator< Scale const * > >,std::vector< double,std::allocator< double > >)\n" + " Datafield::Datafield(std::vector< Scale const *,std::allocator< Scale const * > >)\n" " Datafield::Datafield(Datafield const &)\n" " Datafield::Datafield(Datafield &&)\n"); return 0; @@ -40930,7 +40924,7 @@ static PyMethodDef SwigMethods[] = { { "new_Datafield", _wrap_new_Datafield, METH_VARARGS, "\n" "Datafield(std::string title, Frame frame, vdouble1d_t values={}, vdouble1d_t errSigmas={})\n" "Datafield(Frame frame, vdouble1d_t values={}, vdouble1d_t errSigmas={})\n" - "Datafield(std::vector< Scale const *,std::allocator< Scale const * > > && axes, vdouble1d_t values={}, vdouble1d_t errSigmas={})\n" + "Datafield(std::vector< Scale const *,std::allocator< Scale const * > > axes, vdouble1d_t values={}, vdouble1d_t errSigmas={})\n" "Datafield(Datafield arg1)\n" "new_Datafield(Datafield arg1) -> Datafield\n" ""},