gdcmCommandManager.h

Go to the documentation of this file.
00001 /*=========================================================================
00002                                                                                 
00003   Program:   gdcm
00004   Module:    $RCSfile: gdcmCommandManager.h,v $
00005   Language:  C++
00006   Date:      $Date: 2007/08/22 16:14:03 $
00007   Version:   $Revision: 1.6 $
00008                                                                                 
00009   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
00010   l'Image). All rights reserved. See Doc/License.txt or
00011   http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
00012                                                                                 
00013      This software is distributed WITHOUT ANY WARRANTY; without even
00014      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00015      PURPOSE.  See the above copyright notices for more information.
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 } // end namespace gdcm
00072 
00073 //-----------------------------------------------------------------------------
00074 #endif

Generated on Fri Aug 24 12:53:08 2007 for gdcm by  doxygen 1.4.6