1 /*=========================================================================
4 Module: $RCSfile: gdcmCommandManager.cxx,v $
6 Date: $Date: 2005/11/28 15:20:35 $
7 Version: $Revision: 1.1 $
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.
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.
17 =========================================================================*/
18 // ---------------------------------------------------------------
19 #include "gdcmCommandManager.h"
20 #include "gdcmCommand.h"
24 //-----------------------------------------------------------------------------
25 // Constructor / Destructor
27 * \brief Constructor used when we want to generate dicom files from scratch
29 CommandManager::CommandManager()
35 * \brief Canonical destructor.
37 CommandManager::~CommandManager ()
41 //-----------------------------------------------------------------------------
43 void CommandManager::SetCommand(unsigned int type,Command *command)
45 Command *cmd=CommandList[type];
52 CommandList[type]=command;
56 CommandList.erase(type);
60 Command *CommandManager::GetCommand(unsigned int type) const
64 return CommandList[type];
72 bool CommandManager::ExecuteCommand(unsigned int type,std::string text)
74 Command *cmd = GetCommand(type);
86 bool CommandManager::ConstExecuteCommand(unsigned int type,std::string text) const
88 Command *cmd = GetCommand(type);
92 cmd->SetConstObject(this);
100 //-----------------------------------------------------------------------------
103 //-----------------------------------------------------------------------------
106 //-----------------------------------------------------------------------------
108 void CommandManager::Print(std::ostream &os, std::string const &indent)
110 os<<indent<<"Command list : \n";
111 CommandHT::iterator it;
112 for(it=CommandList.begin();it!=CommandList.end();++it)
114 os<<indent<<" "<<Command::GetCommandAsString(it->first)
115 <<" : "<<typeid(it->second).name()
116 <<" ("<<it->second<<")"<<std::endl;
120 //-----------------------------------------------------------------------------
121 } // end namespace gdcm