]> Creatis software - gdcm.git/blob - src/gdcmCallbackCommand.cxx
#include <algorithm>
[gdcm.git] / src / gdcmCallbackCommand.cxx
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: gdcmCallbackCommand.cxx,v $
5   Language:  C++
6   Date:      $Date: 2007/09/18 15:59:48 $
7   Version:   $Revision: 1.4 $
8                                                                                 
9   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10   l'Image). All rights reserved. See Doc/License.txt or
11   http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
12                                                                                 
13      This software is distributed WITHOUT ANY WARRANTY; without even
14      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15      PURPOSE.  See the above copyright notices for more information.
16                                                                                 
17 =========================================================================*/
18 // ---------------------------------------------------------------
19 #include "gdcmCallbackCommand.h"
20
21 namespace GDCM_NAME_SPACE 
22 {
23 //-----------------------------------------------------------------------------
24 // Constructor / Destructor
25 /**
26  * \brief Constructor used when we want to generate dicom files from scratch
27  */
28 CallbackCommand::CallbackCommand()
29 {
30    Callback             = NULL;
31    CallbackArgDelete    = NULL;
32    CallbackArg          = NULL;
33 }
34
35 /**
36  * \brief   Canonical destructor.
37  */
38 CallbackCommand::~CallbackCommand ()
39 {
40 //   SetCallback(NULL,NULL,NULL);
41 }
42
43 //-----------------------------------------------------------------------------
44 // Public
45 /**
46  * \brief   Set the callback method
47  * @param   callback Method to call
48  * @param   arg    Argument to pass to the method
49  * \warning In python : the arg parameter isn't considered
50  */
51  
52 /*void CallbackCommand::SetCallback( CallbackCommand::CbkMethod *callback,void *arg )
53 {
54    SetCallback(callback,arg,NULL);
55 }*/
56
57 /*
58  *\brief   Set the callback method to delete the argument
59  *          The argument is destroyed when the callback method is changed 
60  *          or when the class is destroyed
61  * @param   callback Method to call to delete the argument
62  */
63 /*void CallbackCommand::SetCallbackArgDelete( CallbackCommand::CbkMethod *callback ) 
64 {
65    CallbackArgDelete = callback;
66 }*/
67
68 /*
69  *\brief   Set the callback method
70  * @param   callback Method to call
71  * @param   arg    Argument to pass to the method
72  * @param   argDelete    Argument 
73  * \warning In python : the arg parameter isn't considered
74  */
75 /*void CallbackCommand::SetCallback( void(*callback)(void *),
76                                   void *arg, void(*argDelete)(void *) )
77 {
78    if ( CallbackArg && CallbackArgDelete )
79    {
80       CallbackArgDelete( CallbackArg );
81    }
82
83    Callback          = callback;
84    CallbackArg       = arg;
85    CallbackArgDelete = argDelete;
86 }*/
87
88 void CallbackCommand::SetCallback(CallbackCommand::CbkMethod *callback)
89 {
90    Callback=callback;
91 }
92
93 void CallbackCommand::Execute()
94 {
95    if(Callback)
96       Callback(this);
97 }
98
99 //-----------------------------------------------------------------------------
100 // Protected
101
102 //-----------------------------------------------------------------------------
103 // Private
104
105 //-----------------------------------------------------------------------------
106 // Print
107
108 //-----------------------------------------------------------------------------
109 } // end namespace gdcm