+////////////////////////////////////////////////
+// Convert a DocEntry * to the real derived class
+%typemap(out) gdcm::DocEntry *
+{
+ PyObject *newEntry;
+
+ if($1)
+ {
+ if(dynamic_cast<SeqEntry *>($1)) // SeqEntry *
+ newEntry = SWIG_NewPointerObj($1,SWIGTYPE_p_gdcm__SeqEntry,0);
+ else if(dynamic_cast<BinEntry *>($1)) // BinEntry *
+ newEntry = SWIG_NewPointerObj($1,SWIGTYPE_p_gdcm__BinEntry,0);
+ else // ValEntry *
+ newEntry = SWIG_NewPointerObj($1,SWIGTYPE_p_gdcm__ValEntry,0);
+ }
+ else
+ {
+ newEntry = Py_BuildValue("");
+ }
+ $result = newEntry;
+}
+