From b3c831713dfbb7d31592e3456898bfee5f729227 Mon Sep 17 00:00:00 2001
From: Matthias Puchner <github@mpuchner.de>
Date: Mon, 26 Apr 2021 07:44:34 +0200
Subject: [PATCH] minor changes (rename, public->protected, unit test)

---
 Param/Base/IParametricComponent.h    |  22 +++---
 auto/Wrap/libBornAgainParam_wrap.cpp | 106 ---------------------------
 2 files changed, 9 insertions(+), 119 deletions(-)

diff --git a/Param/Base/IParametricComponent.h b/Param/Base/IParametricComponent.h
index 220737505fd..6b1d6b9fe3b 100644
--- a/Param/Base/IParametricComponent.h
+++ b/Param/Base/IParametricComponent.h
@@ -36,6 +36,9 @@ public:
 
     IParametricComponent& operator=(const IParametricComponent& other) = delete;
 
+    void setName(const std::string& name) { m_name = name; }
+    const std::string& getName() const { return m_name; }
+
     //! Returns parameters which have been registered in this component (none from in
     //! parents/children)
     const std::vector<RealParameter*> registeredParameters() const;
@@ -60,6 +63,9 @@ protected:
     void registerVector(const std::string& base_name, kvector_t* p_vec,
                         const std::string& units = "nm");
 
+    // #baPool + docu
+    void removeParameter(const double* p);
+    void removeVector(const std::string& base_name);
 
     // #baPool docu taken from createParameterTree. Rectify!!
     //! Creates new parameter pool, with all local parameters. Since IParametericComponent has no
@@ -70,28 +76,18 @@ protected:
     //! c.registerParameter("MyParam") => returned pool contains "/MyComponent/MyParam"
     virtual std::vector<std::pair<std::string, RealParameter*>>
     fullQualifiedParameters() const; // #baPool + rename (hierarchy!)
+
+    bool isVectorRegistered(kvector_t* p_vec) const;
+
 private:
     void removeParameter(const std::string& name);
     // #baPool + docu
     RealParameter* parameter(const std::string& name) const;
 
-public:
-    // #baPool + docu
-    void removeParameter(const double* p);
-
-    bool isVectorRegistered(kvector_t* p_vec) const;
-
-    void removeVector(const std::string& base_name);
-
-private:
     static std::string XComponentName(const std::string& base_name);
     static std::string YComponentName(const std::string& base_name);
     static std::string ZComponentName(const std::string& base_name);
 
-public:
-    void setName(const std::string& name) { m_name = name; }
-    const std::string& getName() const { return m_name; }
-
 private:
     std::string m_name;
 
diff --git a/auto/Wrap/libBornAgainParam_wrap.cpp b/auto/Wrap/libBornAgainParam_wrap.cpp
index bc067733266..110819cb257 100644
--- a/auto/Wrap/libBornAgainParam_wrap.cpp
+++ b/auto/Wrap/libBornAgainParam_wrap.cpp
@@ -34563,101 +34563,6 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_IParametricComponent_removeParameter(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  IParametricComponent *arg1 = (IParametricComponent *) 0 ;
-  double *arg2 = (double *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp2 = 0 ;
-  int res2 = 0 ;
-  PyObject *swig_obj[2] ;
-  
-  if (!SWIG_Python_UnpackTuple(args, "IParametricComponent_removeParameter", 2, 2, swig_obj)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_IParametricComponent, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IParametricComponent_removeParameter" "', argument " "1"" of type '" "IParametricComponent *""'"); 
-  }
-  arg1 = reinterpret_cast< IParametricComponent * >(argp1);
-  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_double, 0 |  0 );
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "IParametricComponent_removeParameter" "', argument " "2"" of type '" "double const *""'"); 
-  }
-  arg2 = reinterpret_cast< double * >(argp2);
-  (arg1)->removeParameter((double const *)arg2);
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_IParametricComponent_isVectorRegistered(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  IParametricComponent *arg1 = (IParametricComponent *) 0 ;
-  kvector_t *arg2 = (kvector_t *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp2 = 0 ;
-  int res2 = 0 ;
-  PyObject *swig_obj[2] ;
-  bool result;
-  
-  if (!SWIG_Python_UnpackTuple(args, "IParametricComponent_isVectorRegistered", 2, 2, swig_obj)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_IParametricComponent, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IParametricComponent_isVectorRegistered" "', argument " "1"" of type '" "IParametricComponent const *""'"); 
-  }
-  arg1 = reinterpret_cast< IParametricComponent * >(argp1);
-  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_BasicVector3DT_double_t, 0 |  0 );
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "IParametricComponent_isVectorRegistered" "', argument " "2"" of type '" "kvector_t *""'"); 
-  }
-  arg2 = reinterpret_cast< kvector_t * >(argp2);
-  result = (bool)((IParametricComponent const *)arg1)->isVectorRegistered(arg2);
-  resultobj = SWIG_From_bool(static_cast< bool >(result));
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_IParametricComponent_removeVector(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  IParametricComponent *arg1 = (IParametricComponent *) 0 ;
-  std::string *arg2 = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int res2 = SWIG_OLDOBJ ;
-  PyObject *swig_obj[2] ;
-  
-  if (!SWIG_Python_UnpackTuple(args, "IParametricComponent_removeVector", 2, 2, swig_obj)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_IParametricComponent, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IParametricComponent_removeVector" "', argument " "1"" of type '" "IParametricComponent *""'"); 
-  }
-  arg1 = reinterpret_cast< IParametricComponent * >(argp1);
-  {
-    std::string *ptr = (std::string *)0;
-    res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "IParametricComponent_removeVector" "', argument " "2"" of type '" "std::string const &""'"); 
-    }
-    if (!ptr) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "IParametricComponent_removeVector" "', argument " "2"" of type '" "std::string const &""'"); 
-    }
-    arg2 = ptr;
-  }
-  (arg1)->removeVector((std::string const &)*arg2);
-  resultobj = SWIG_Py_Void();
-  if (SWIG_IsNewObj(res2)) delete arg2;
-  return resultobj;
-fail:
-  if (SWIG_IsNewObj(res2)) delete arg2;
-  return NULL;
-}
-
-
 SWIGINTERN PyObject *_wrap_IParametricComponent_setName(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   IParametricComponent *arg1 = (IParametricComponent *) 0 ;
@@ -49989,17 +49894,6 @@ static PyMethodDef SwigMethods[] = {
 		""},
 	 { "IParametricComponent_getMatchedParameters", _wrap_IParametricComponent_getMatchedParameters, METH_VARARGS, "IParametricComponent_getMatchedParameters(IParametricComponent self, std::string const & pattern) -> std::vector< RealParameter *,std::allocator< RealParameter * > >"},
 	 { "IParametricComponent_fullQualifiedParameters", _wrap_IParametricComponent_fullQualifiedParameters, METH_O, "IParametricComponent_fullQualifiedParameters(IParametricComponent self) -> std::vector< std::pair< std::string,RealParameter * >,std::allocator< std::pair< std::string,RealParameter * > > >"},
-	 { "IParametricComponent_removeParameter", _wrap_IParametricComponent_removeParameter, METH_VARARGS, "\n"
-		"IParametricComponent_removeParameter(IParametricComponent self, double const * p)\n"
-		"void IParametricComponent::removeParameter(const std::string &name)\n"
-		"\n"
-		""},
-	 { "IParametricComponent_isVectorRegistered", _wrap_IParametricComponent_isVectorRegistered, METH_VARARGS, "IParametricComponent_isVectorRegistered(IParametricComponent self, kvector_t p_vec) -> bool"},
-	 { "IParametricComponent_removeVector", _wrap_IParametricComponent_removeVector, METH_VARARGS, "\n"
-		"IParametricComponent_removeVector(IParametricComponent self, std::string const & base_name)\n"
-		"void IParametricComponent::removeVector(const std::string &base_name)\n"
-		"\n"
-		""},
 	 { "IParametricComponent_setName", _wrap_IParametricComponent_setName, METH_VARARGS, "\n"
 		"IParametricComponent_setName(IParametricComponent self, std::string const & name)\n"
 		"void IParametricComponent::setName(const std::string &name)\n"
-- 
GitLab