1 // Copyright (C) 2014-2015 EDF-R&D
2 // This library is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU Lesser General Public
4 // License as published by the Free Software Foundation; either
5 // version 2.1 of the License, or (at your option) any later version.
7 // This library is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 // Lesser General Public License for more details.
12 // You should have received a copy of the GNU Lesser General Public
13 // License along with this library; if not, write to the Free Software
14 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include <NCollection_Sequence.hxx>
23 %MappedType NCollection_Sequence<opencascade::handle<HYDROData_Entity>>
26 #include <NCollection_Sequence.hxx>
33 if ((l = PyList_New(sipCpp->Length())) == NULL)
36 // Set the list elements.
37 for (int i = 1; i <= sipCpp->Length(); ++i)
39 HYDROData_Entity* aPntr = createPointer(sipCpp->Value(i));
43 if ((tobj = sipConvertFromNewType(aPntr, sipFindType( aPntr->DynamicType()->Name() ), sipTransferObj)) == NULL)
47 Handle(HYDROData_Entity) anEnt( aPntr );
53 PyList_SET_ITEM(l, i - 1, tobj);
62 // Check the type if that is all that is required.
65 if (!PySequence_Check(sipPy) || (len = PySequence_Size(sipPy)) < 0)
68 for (SIP_SSIZE_T i = 0; i < len; ++i)
70 PyObject *itm = PySequence_ITEM(sipPy, i);
71 bool ok = (itm && sipCanConvertToType(itm, sipType_HYDROData_Entity, SIP_NOT_NONE));
82 NCollection_Sequence<Handle(HYDROData_Entity)> *aSeq =
83 new NCollection_Sequence<Handle(HYDROData_Entity)>;
84 len = PySequence_Size(sipPy);
86 for (SIP_SSIZE_T i = 0; i < len; ++i)
88 PyObject *itm = PySequence_ITEM(sipPy, i);
91 reinterpret_cast<HYDROData_Entity *>(sipConvertToType(itm, sipType_HYDROData_Entity, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr));
97 sipReleaseType(t, sipType_HYDROData_Entity, state);
103 Handle(HYDROData_Entity) anEnt( t );
104 aSeq->Append( anEnt );
106 //sipReleaseType(t, sipType_HYDROData_Entity, state);
111 return sipGetState(sipTransferObj);
115 typedef NCollection_Sequence<opencascade::handle<HYDROData_Entity>> HYDROData_SequenceOfObjects;