00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 #ifndef _GDCMCOMMANDMANAGER_H_
00020 #define _GDCMCOMMANDMANAGER_H_
00021 
00022 #include "gdcmRefCounter.h"
00023 
00024 #include <map>
00025 #include <iostream>
00026 
00027 namespace GDCM_NAME_SPACE 
00028 {
00029 
00030 class Command;
00031 typedef std::pair<const Base *, unsigned int> CommandKey;
00032 typedef std::map<CommandKey,Command *> CommandHT;
00033 
00034 
00040 class GDCM_EXPORT CommandManager : public Base
00041 {
00042    gdcmTypeMacro(CommandManager);
00043 
00044 public:
00045    void Print(std::ostream &os = std::cout, std::string const &indent = "" );
00046 
00047    static void SetCommand(const Base *object, unsigned int type, Command *command);
00048    static Command *GetCommand(const Base *object, unsigned int type);
00049 
00050    static bool ExecuteCommand(Base *object, unsigned int type, std::string text = "");
00051    static bool ExecuteCommandConst(const Base *object, unsigned int type, std::string text = "");
00052 
00053    static const CommandManager *GetInstance();
00054 
00055    ~CommandManager();
00056 
00057 protected:
00058    CommandManager();
00059 
00060    void InClearCommand(void);
00061    void InSetCommand(const Base *object, unsigned int type, Command *command);
00062    Command *InGetCommand(const Base *object, unsigned int type);
00063 
00064    bool InExecuteCommand(Base *object, unsigned int type, std::string text = "");
00065    bool InExecuteCommandConst(const Base *object, unsigned int type, std::string text = "");
00066 
00067 private:
00068    static CommandManager Instance;
00069    CommandHT CommandList;
00070 };
00071 } 
00072 
00073 
00074 #endif