]> Creatis software - gdcm.git/blob - src/gdcmCommandManager.h
Fix mistypings
[gdcm.git] / src / gdcmCommandManager.h
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: gdcmCommandManager.h,v $
5   Language:  C++
6   Date:      $Date: 2007/08/22 16:14:03 $
7   Version:   $Revision: 1.6 $
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_NAME_SPACE 
28 {
29 //-----------------------------------------------------------------------------
30 class Command;
31 typedef std::pair<const Base *, unsigned int> CommandKey;
32 typedef std::map<CommandKey,Command *> CommandHT;
33
34 //-----------------------------------------------------------------------------
35 /**
36  * \brief CommandManager base class to react on a gdcm event
37  *
38  * \remarks The execution parameter depends on the
39  */
40 class GDCM_EXPORT CommandManager : public Base
41 {
42    gdcmTypeMacro(CommandManager);
43
44 public:
45    void Print(std::ostream &os = std::cout, std::string const &indent = "" );
46
47    static void SetCommand(const Base *object, unsigned int type, Command *command);
48    static Command *GetCommand(const Base *object, unsigned int type);
49
50    static bool ExecuteCommand(Base *object, unsigned int type, std::string text = "");
51    static bool ExecuteCommandConst(const Base *object, unsigned int type, std::string text = "");
52
53    static const CommandManager *GetInstance();
54
55    ~CommandManager();
56
57 protected:
58    CommandManager();
59
60    void InClearCommand(void);
61    void InSetCommand(const Base *object, unsigned int type, Command *command);
62    Command *InGetCommand(const Base *object, unsigned int type);
63
64    bool InExecuteCommand(Base *object, unsigned int type, std::string text = "");
65    bool InExecuteCommandConst(const Base *object, unsigned int type, std::string text = "");
66
67 private:
68    static CommandManager Instance;
69    CommandHT CommandList;
70 };
71 } // end namespace gdcm
72
73 //-----------------------------------------------------------------------------
74 #endif