Salome HOME
Correction for hydro_test
[modules/hydro.git] / src / HYDROPy / HYDROData_Entity.sip
index 2aedac541dd36ceb3d6e087e28ef6618fbe9ef29..344d691a3f7db18c609d49ef90108a1c9d1b23fd 100644 (file)
@@ -188,7 +188,7 @@ public:
   /**
    * Updates the name of this object.
    */
-  virtual void SetName(const QString& theName);
+  virtual void SetName(const QString& theName, bool isDefault = false );
 
   /**
    * Updates object state.
@@ -277,3 +277,91 @@ protected:
   virtual ~HYDROData_Entity();
 
 };
+
+
+%MappedType std::vector<HYDROData_Entity*>
+{
+%TypeHeaderCode
+#include <vector>
+%End
+
+%ConvertFromTypeCode
+    // Create the list.
+    PyObject *l;
+
+    if ( ( l = PyList_New( sipCpp->size() ) ) == NULL )
+      return NULL;
+
+    // Set the list elements.
+    for ( int i = 0, n = sipCpp->size(); i < n; ++i )
+    {
+      HYDROData_Entity* t = (*sipCpp)[i];                   //new HYDROData_Entity( ( sipCpp)[i] );
+
+      PyObject* pobj;
+      if ( ( pobj = sipConvertFromNewType( t, sipType_HYDROData_Entity, sipTransferObj ) ) == NULL )
+      {
+        Py_DECREF( l );
+        //delete t;
+
+        return NULL;
+      }
+
+      PyList_SET_ITEM( l, i, pobj );
+    }
+
+    return l;
+%End
+
+%ConvertToTypeCode
+    SIP_SSIZE_T len;
+
+    // Check the type if that is all that is required.
+    if (sipIsErr == NULL)
+    {
+        if (!PySequence_Check(sipPy) || (len = PySequence_Size(sipPy)) < 0)
+            return 0;
+
+        for (SIP_SSIZE_T i = 0; i < len; ++i)
+        {
+            PyObject *itm = PySequence_ITEM(sipPy, i);
+            bool ok = (itm && sipCanConvertToType(itm, sipType_HYDROData_Entity, SIP_NOT_NONE));
+
+            Py_XDECREF(itm);
+
+            if (!ok)
+                return 0;
+        }
+
+        return 1;
+    }
+
+    std::vector<HYDROData_Entity*> *aSeq = new std::vector<HYDROData_Entity*>;
+    len = PySequence_Size(sipPy);
+       aSeq->reserve( len );
+    for (SIP_SSIZE_T i = 0; i < len; ++i)
+    {
+        PyObject *itm = PySequence_ITEM(sipPy, i);
+        int state;
+        HYDROData_Entity *t = reinterpret_cast<HYDROData_Entity *>(sipConvertToType(itm, sipType_HYDROData_Entity, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr));
+
+        Py_DECREF(itm);
+        if (*sipIsErr)
+        {
+            sipReleaseType(t, sipType_HYDROData_Entity, state);
+
+            delete aSeq;
+            return 0;
+        }
+
+        aSeq->push_back(t);
+
+        sipReleaseType(t, sipType_HYDROData_Entity, state);
+    }
+    *sipCppPtr = aSeq;
+    return sipGetState(sipTransferObj);
+%End
+};