using namespace std;
+////////////////////////////////////////////////////////////////////////////
// Utility functions on strings for removing leading and trailing spaces
void EatLeadingAndTrailingSpaces(string & s) {
while ( s.length() && (s[0] == ' ') )
////////////////////////////////////////////////////////////////////////////
// Deals with function returning a C++ string.
-%typemap(python, in) (gdcmMethod *method,void *arg) {
+%typemap(python, in) (gdcmMethod *,void * =NULL,gdcmMethod * =NULL) {
Py_INCREF($input);
$1=vtkPythonVoidFunc;
$2=$input;
+ $3=vtkPythonVoidFuncArgDelete;
}
startMethod=NULL;
progressMethod=NULL;
endMethod=NULL;
+ startMethodArgDelete=NULL;
+ progressMethodArgDelete=NULL;
+ endMethodArgDelete=NULL;
startArg=NULL;
progressArg=NULL;
endArg=NULL;
*/
gdcmDicomDir::~gdcmDicomDir()
{
+ SetStartMethod(NULL);
+ SetProgressMethod(NULL);
+ SetEndMethod(NULL);
+
if(metaElems)
delete metaElems;
CreateDicomDir();
}
+/*
+ * \ingroup gdcmDicomDir
+ * \brief Set the start method to call when the parsing of the directory starts
+ * @param method Method to call
+ * @param arg Argument to pass to the method
+ * \warning In python : the arg parameter isn't considered
+ */
+void gdcmDicomDir::SetStartMethod(gdcmMethod *method,void *arg,gdcmMethod *argDelete)
+{
+ if((startArg)&&(startMethodArgDelete))
+ startMethodArgDelete(startArg);
+
+ startMethod=method;
+ startArg=arg;
+ startMethodArgDelete=argDelete;
+}
+
+/*
+ * \ingroup gdcmDicomDir
+ * \brief Set the method to delete the argument
+ * The argument is destroyed when the method is changed or when the class
+ * is destroyed
+ * @param method Method to call to delete the argument
+ */
+void gdcmDicomDir::SetStartMethodArgDelete(gdcmMethod *method)
+{
+ startMethodArgDelete=method;
+}
+
+/*
+ * \ingroup gdcmDicomDir
+ * \brief Set the progress method to call when the parsing of the directory progress
+ * @param method Method to call
+ * @param arg Argument to pass to the method
+ * \warning In python : the arg parameter isn't considered
+ */
+void gdcmDicomDir::SetProgressMethod(gdcmMethod *method,void *arg,gdcmMethod *argDelete)
+{
+ if((progressArg)&&(progressMethodArgDelete))
+ progressMethodArgDelete(progressArg);
+
+ progressMethod=method;
+ progressArg=arg;
+ progressMethodArgDelete=argDelete;
+}
+
+/*
+ * \ingroup gdcmDicomDir
+ * \brief Set the method to delete the argument
+ * The argument is destroyed when the method is changed or when the class
+ * is destroyed
+ * @param method Method to call to delete the argument
+ */
+void gdcmDicomDir::SetProgressMethodArgDelete(gdcmMethod *method)
+{
+ progressMethodArgDelete=method;
+}
+
+/*
+ * \ingroup gdcmDicomDir
+ * \brief Set the end method to call when the parsing of the directory ends
+ * @param method Method to call
+ * @param arg Argument to pass to the method
+ * \warning In python : the arg parameter isn't considered
+ */
+void gdcmDicomDir::SetEndMethod(gdcmMethod *method,void *arg,gdcmMethod *argDelete)
+{
+ if((endArg)&&(endMethodArgDelete))
+ endMethodArgDelete(endArg);
+
+ endMethod=method;
+ endArg=arg;
+ endMethodArgDelete=argDelete;
+}
+
+/*
+ * \ingroup gdcmDicomDir
+ * \brief Set the method to delete the argument
+ * The argument is destroyed when the method is changed or when the class
+ * is destroyed
+ * @param method Method to call to delete the argument
+ */
+void gdcmDicomDir::SetEndMethodArgDelete(gdcmMethod *method)
+{
+ endMethodArgDelete=method;
+}
+
/**
* \ingroup gdcmDicomDir
* \brief writes on disc a DICOMDIR
// Parsing
void ParseDirectory(void);
- inline void SetStartMethod(gdcmMethod *method,void *arg=NULL) {startMethod=method;startArg=arg;};
- inline void SetProgressMethod(gdcmMethod *method,void *arg=NULL) {progressMethod=method;progressArg=arg;};
- inline void SetEndMethod(gdcmMethod *method,void *arg=NULL) {endMethod=method;endArg=arg;};
+ void SetStartMethod(gdcmMethod *,void * =NULL,gdcmMethod * =NULL);
+ void SetStartMethodArgDelete(gdcmMethod *);
+ void SetProgressMethod(gdcmMethod *,void * =NULL,gdcmMethod * =NULL);
+ void SetProgressMethodArgDelete(gdcmMethod *);
+ void SetEndMethod(gdcmMethod *,void * =NULL,gdcmMethod * =NULL);
+ void SetEndMethodArgDelete(gdcmMethod *);
- inline float GetProgress(void) {return(progress);};
+ inline float GetProgress(void) {return(progress);};
- inline void AbortProgress(void) {abort=true;};
- inline bool IsAborted(void) {return(abort);};
+ inline void AbortProgress(void) {abort=true;};
+ inline bool IsAborted(void) {return(abort);};
// Write
bool Write(std::string fileName);
gdcmMethod *startMethod;
gdcmMethod *progressMethod;
gdcmMethod *endMethod;
+ gdcmMethod *startMethodArgDelete;
+ gdcmMethod *progressMethodArgDelete;
+ gdcmMethod *endMethodArgDelete;
void *startArg;
void *progressArg;
void *endArg;