]> Creatis software - gdcm.git/blob - src/gdcmCallbackCommand.cxx
Forgot to update this one
[gdcm.git] / src / gdcmCallbackCommand.cxx
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: gdcmCallbackCommand.cxx,v $
5   Language:  C++
6   Date:      $Date: 2007/05/23 14:18:07 $
7   Version:   $Revision: 1.3 $
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   method Method to call
48  * @param   arg    Argument to pass to the method
49  * \warning In python : the arg parameter isn't considered
50  */
51 /*void CallbackCommand::SetCallback( CallbackCommand::CbkMethod *callback,void *arg )
52 {
53    SetCallback(callback,arg,NULL);
54 }*/
55
56 /**
57  * \brief   Set the callback method to delete the argument
58  *          The argument is destroyed when the callback method is changed 
59  *          or when the class is destroyed
60  * @param   method Method to call to delete the argument
61  */
62 /*void CallbackCommand::SetCallbackArgDelete( CallbackCommand::CbkMethod *callback ) 
63 {
64    CallbackArgDelete = callback;
65 }*/
66
67 /**
68  * \brief   Set the callback method
69  * @param   method Method to call
70  * @param   arg    Argument to pass to the method
71  * @param   argDelete    Argument 
72  * \warning In python : the arg parameter isn't considered
73  */
74 /*void CallbackCommand::SetCallback( void(*callback)(void *),
75                                    void *arg,void(*argDelete)(void *) )
76 {
77    if ( CallbackArg && CallbackArgDelete )
78    {
79       CallbackArgDelete( CallbackArg );
80    }
81
82    Callback          = callback;
83    CallbackArg       = arg;
84    CallbackArgDelete = argDelete;
85 }*/
86
87 void CallbackCommand::SetCallback(CallbackCommand::CbkMethod *callback)
88 {
89    Callback=callback;
90 }
91
92 void CallbackCommand::Execute()
93 {
94    if(Callback)
95       Callback(this);
96 }
97
98 //-----------------------------------------------------------------------------
99 // Protected
100
101 //-----------------------------------------------------------------------------
102 // Private
103
104 //-----------------------------------------------------------------------------
105 // Print
106
107 //-----------------------------------------------------------------------------
108 } // end namespace gdcm