X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmCommandManager.h;h=6dac018da900d4cbe96945a483d444a52582e733;hb=fc4f7706c78baf3f60474c06d871b82db221f37b;hp=55966e012b5a9f85a198e4a8cbffeed47a47e3d7;hpb=46afb30d2d016a9b1581c7ee4ca96d614a35203c;p=gdcm.git diff --git a/src/gdcmCommandManager.h b/src/gdcmCommandManager.h index 55966e01..6dac018d 100644 --- a/src/gdcmCommandManager.h +++ b/src/gdcmCommandManager.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmCommandManager.h,v $ Language: C++ - Date: $Date: 2005/11/28 15:20:35 $ - Version: $Revision: 1.1 $ + Date: $Date: 2007/08/22 16:14:03 $ + Version: $Revision: 1.6 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -16,19 +16,20 @@ =========================================================================*/ -#ifndef GDCMCOMMANDMANAGER_H -#define GDCMCOMMANDMANAGER_H +#ifndef _GDCMCOMMANDMANAGER_H_ +#define _GDCMCOMMANDMANAGER_H_ #include "gdcmRefCounter.h" #include #include -namespace gdcm +namespace GDCM_NAME_SPACE { //----------------------------------------------------------------------------- class Command; -typedef std::map CommandHT; +typedef std::pair CommandKey; +typedef std::map CommandHT; //----------------------------------------------------------------------------- /** @@ -36,27 +37,36 @@ typedef std::map CommandHT; * * \remarks The execution parameter depends on the */ -class GDCM_EXPORT CommandManager : public RefCounter +class GDCM_EXPORT CommandManager : public Base { gdcmTypeMacro(CommandManager); public: - /// \brief Contructs an empty Dict with a RefCounter - static CommandManager *New() {return new CommandManager();} void Print(std::ostream &os = std::cout, std::string const &indent = "" ); - void SetCommand(unsigned int type,Command *command); - Command *GetCommand(unsigned int type) const; + static void SetCommand(const Base *object, unsigned int type, Command *command); + static Command *GetCommand(const Base *object, unsigned int type); - bool ExecuteCommand(unsigned int type,std::string text = ""); - bool ConstExecuteCommand(unsigned int type,std::string text = "") const; + static bool ExecuteCommand(Base *object, unsigned int type, std::string text = ""); + static bool ExecuteCommandConst(const Base *object, unsigned int type, std::string text = ""); + + static const CommandManager *GetInstance(); + + ~CommandManager(); protected: CommandManager(); - ~CommandManager(); + + void InClearCommand(void); + void InSetCommand(const Base *object, unsigned int type, Command *command); + Command *InGetCommand(const Base *object, unsigned int type); + + bool InExecuteCommand(Base *object, unsigned int type, std::string text = ""); + bool InExecuteCommandConst(const Base *object, unsigned int type, std::string text = ""); private: - mutable CommandHT CommandList; + static CommandManager Instance; + CommandHT CommandList; }; } // end namespace gdcm