00001 /*========================================================================= 00002 00003 Program: gdcm 00004 Module: $RCSfile: gdcmCommand.cxx,v $ 00005 Language: C++ 00006 Date: $Date: 2007/05/23 14:18:08 $ 00007 Version: $Revision: 1.3 $ 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 #include "gdcmCommand.h" 00020 00021 namespace GDCM_NAME_SPACE 00022 { 00023 //----------------------------------------------------------------------------- 00024 // Constructor / Destructor 00028 Command::Command() 00029 { 00030 Cmd = CMD_UNKNOWN; 00031 Object = NULL; 00032 ConstObject = NULL; 00033 Text = ""; 00034 } 00035 00036 00040 Command::~Command () 00041 { 00042 } 00043 00044 //----------------------------------------------------------------------------- 00045 // Public 00046 void Command::SetType(unsigned int type) 00047 { 00048 Cmd = type; 00049 } 00050 00051 unsigned int Command::GetType() const 00052 { 00053 return Cmd; 00054 } 00055 00056 void Command::SetObject(Base *object) 00057 { 00058 Object = object; 00059 } 00060 00061 Base *Command::GetObject() const 00062 { 00063 return Object; 00064 } 00065 00066 void Command::SetConstObject(const Base *object) 00067 { 00068 ConstObject = object; 00069 } 00070 00071 const Base *Command::GetConstObject() const 00072 { 00073 if(ConstObject) 00074 return ConstObject; 00075 else 00076 return GetObject(); 00077 } 00078 00079 void Command::SetText(const std::string &text) 00080 { 00081 Text = text; 00082 } 00083 00084 const std::string &Command::GetText(void) const 00085 { 00086 return Text; 00087 } 00088 00089 void Command::Execute() 00090 { 00091 } 00092 00093 const char *Command::GetCommandAsString(unsigned int command) 00094 { 00095 switch(command) 00096 { 00097 case CMD_UNKNOWN: 00098 return "Unknown"; 00099 case CMD_DEBUG: 00100 return "Debug"; 00101 case CMD_WARNING: 00102 return "Warning"; 00103 case CMD_ERROR: 00104 return "Error"; 00105 case CMD_ASSERT: 00106 return "Assert"; 00107 case CMD_STARTPROGRESS: 00108 return "StartProgress"; 00109 case CMD_ENDPROGRESS: 00110 return "EndProgress"; 00111 case CMD_PROGRESS: 00112 return "Progress"; 00113 default: 00114 return "Undefined !!!"; 00115 } 00116 } 00117 00118 //----------------------------------------------------------------------------- 00119 // Protected 00120 00121 //----------------------------------------------------------------------------- 00122 // Private 00123 00124 //----------------------------------------------------------------------------- 00125 // Print 00126 00127 //----------------------------------------------------------------------------- 00128 } // end namespace gdcm