+////////////////////////////////////////////////////////////////////////////
+%typemap(out) ListDicomDirPatient & {
+ PyObject* NewItem = (PyObject*)0;
+ $result = PyList_New(0); // The result of this typemap
+
+ for (std::list<gdcm::DicomDirPatient *>::iterator New = ($1)->begin();
+ New != ($1)->end(); ++New) {
+ NewItem = SWIG_NewPointerObj(*New,SWIGTYPE_p_DicomDirPatient,1);
+ PyList_Append($result, NewItem);
+ }
+}
+
+%typemap(out) ListDicomDirStudy & {
+ PyObject* NewItem = (PyObject*)0;
+ $result = PyList_New(0); // The result of this typemap
+
+ for (std::list<gdcm::DicomDirStudy *>::iterator New = ($1)->begin();
+ New != ($1)->end(); ++New) {
+ NewItem = SWIG_NewPointerObj(*New,SWIGTYPE_p_DicomDirStudy,1);
+ PyList_Append($result, NewItem);
+ }
+}
+
+%typemap(out) ListDicomDirSerie & {
+ PyObject* NewItem = (PyObject*)0;
+ $result = PyList_New(0); // The result of this typemap
+
+ for (std::list<gdcm::DicomDirSerie *>::iterator New = ($1)->begin();
+ New != ($1)->end(); ++New) {
+ NewItem = SWIG_NewPointerObj(*New,SWIGTYPE_p_DicomDirSerie,1);
+ PyList_Append($result, NewItem);
+ }
+}
+
+%typemap(out) ListDicomDirImage & {
+ PyObject* NewItem = (PyObject*)0;
+ $result = PyList_New(0); // The result of this typemap
+
+ for (std::list<gdcm::DicomDirImage *>::iterator New = ($1)->begin();
+ New != ($1)->end(); ++New) {
+ NewItem = SWIG_NewPointerObj(*New,SWIGTYPE_p_DicomDirImage,1);
+ PyList_Append($result, NewItem);
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////
+// Deals with function returning a C++ string.
+%typemap(python, in) (gdcm::Method *,void * =NULL,gdcm::Method * =NULL) {
+ if($input!=Py_None)
+ {
+ Py_INCREF($input);
+ $1=gdcmPythonVoidFunc;
+ $2=$input;
+ $3=gdcmPythonVoidFuncArgDelete;
+ }
+ else
+ {
+ $1=NULL;
+ $2=NULL;
+ $3=NULL;
+ }
+}
+
+
+////////////////////////////////////////////////////////////////////////////
+// Deals with function returning a C++ string.
+%typemap(out) string, std::string {
+ $result = PyString_FromString(($1).c_str());
+}
+
+%typemap(python, in) const std::string, std::string
+{
+ $1 = PyString_AsString($input);
+}
+
+////////////////////////////////////////////////////////////////////////////
+// Warning: Order matters !