00001 /*========================================================================= 00002 00003 Program: gdcm 00004 Module: $RCSfile: gdcmCallbackCommand.h,v $ 00005 Language: C++ 00006 Date: $Date: 2007/08/22 16:14:03 $ 00007 Version: $Revision: 1.3 $ 00008 00009 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de 00010 l'Image). All rights reserved. See Doc/License.txt or 00011 http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details. 00012 00013 This software is distributed WITHOUT ANY WARRANTY; without even 00014 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00015 PURPOSE. See the above copyright notices for more information. 00016 00017 =========================================================================*/ 00018 00019 #ifndef _GDCMCALLBACKCOMMAND_H_ 00020 #define _GDCMCALLBACKCOMMAND_H_ 00021 00022 #include "gdcmDebug.h" 00023 #include "gdcmCommand.h" 00024 00025 namespace GDCM_NAME_SPACE 00026 { 00027 //----------------------------------------------------------------------------- 00033 class GDCM_EXPORT CallbackCommand : public Command 00034 { 00035 gdcmTypeMacro(CallbackCommand); 00036 gdcmNewMacro(CallbackCommand); 00037 00038 public: 00039 00040 typedef void CbkMethod(CallbackCommand *); 00041 00042 /* // Note: the CallbackCommand:: namespace prefix is needed by Swig in the 00043 // following method declarations. Refer to gdcmPython/gdcm.i 00044 // for the reasons of this unnecessary notation at C++ level. 00045 void SetCallback(CallbackCommand::CbkMethod *callback,void *arg = NULL ); 00046 void SetCallbackArgDelete(CallbackCommand::CbkMethod *callback); 00047 // Note: replace CallbackCommand::Method *method to void(*method)(void *) to 00048 // avoid wrapping problems with the typemap conversions 00049 void SetCallback(void(*callback)(void *), // CallbackCommand::Method *method 00050 void *arg, 00051 void(*argDelete)(void *)); 00052 */ 00053 void SetCallback(CallbackCommand::CbkMethod *callback); 00054 00055 virtual void Execute(); 00056 00057 protected: 00058 CallbackCommand(); 00059 virtual ~CallbackCommand(); 00060 00061 private: 00063 CbkMethod *Callback; 00065 CbkMethod *CallbackArgDelete; 00067 void *CallbackArg; 00068 }; 00069 } // end namespace gdcm 00070 00071 //----------------------------------------------------------------------------- 00072 #endif