]> Creatis software - gdcm.git/blob - src/gdcmCommandManager.h
55966e012b5a9f85a198e4a8cbffeed47a47e3d7
[gdcm.git] / src / gdcmCommandManager.h
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: gdcmCommandManager.h,v $
5   Language:  C++
6   Date:      $Date: 2005/11/28 15:20:35 $
7   Version:   $Revision: 1.1 $
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 #ifndef GDCMCOMMANDMANAGER_H
20 #define GDCMCOMMANDMANAGER_H
21
22 #include "gdcmRefCounter.h"
23
24 #include <map>
25 #include <iostream>
26
27 namespace gdcm 
28 {
29 //-----------------------------------------------------------------------------
30 class Command;
31 typedef std::map<unsigned int,Command *> CommandHT;
32
33 //-----------------------------------------------------------------------------
34 /**
35  * \brief CommandManager base class to react on a gdcm event
36  *
37  * \remarks The execution parameter depends on the
38  */
39 class GDCM_EXPORT CommandManager : public RefCounter
40 {
41    gdcmTypeMacro(CommandManager);
42
43 public:
44    /// \brief Contructs an empty Dict with a RefCounter
45    static CommandManager *New() {return new CommandManager();}
46    void Print(std::ostream &os = std::cout, std::string const &indent = "" );
47
48    void SetCommand(unsigned int type,Command *command);
49    Command *GetCommand(unsigned int type) const;
50
51    bool ExecuteCommand(unsigned int type,std::string text = "");
52    bool ConstExecuteCommand(unsigned int type,std::string text = "") const;
53
54 protected:
55    CommandManager();
56    ~CommandManager();
57
58 private:
59    mutable CommandHT CommandList;
60 };
61 } // end namespace gdcm
62
63 //-----------------------------------------------------------------------------
64 #endif