]> Creatis software - gdcm.git/blob - src/gdcmCommand.cxx
Forgot to update this one
[gdcm.git] / src / gdcmCommand.cxx
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: gdcmCommand.cxx,v $
5   Language:  C++
6   Date:      $Date: 2007/05/23 14:18:08 $
7   Version:   $Revision: 1.3 $
8                                                                                 
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.
12                                                                                 
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.
16                                                                                 
17 =========================================================================*/
18 // ---------------------------------------------------------------
19 #include "gdcmCommand.h"
20
21 namespace GDCM_NAME_SPACE 
22 {
23 //-----------------------------------------------------------------------------
24 // Constructor / Destructor
25 /**
26  * \brief Constructor used when we want to generate dicom files from scratch
27  */
28 Command::Command()
29 {
30    Cmd = CMD_UNKNOWN;
31    Object = NULL;
32    ConstObject = NULL;
33    Text = "";
34 }
35
36
37 /**
38  * \brief   Canonical destructor.
39  */
40 Command::~Command ()
41 {
42 }
43
44 //-----------------------------------------------------------------------------
45 // Public
46 void Command::SetType(unsigned int type)
47 {
48    Cmd = type;
49 }
50
51 unsigned int Command::GetType() const
52 {
53    return Cmd;
54 }
55
56 void Command::SetObject(Base *object)
57 {
58    Object = object;
59 }
60
61 Base *Command::GetObject() const
62 {
63    return Object;
64 }
65
66 void Command::SetConstObject(const Base *object)
67 {
68    ConstObject = object;
69 }
70
71 const Base *Command::GetConstObject() const
72 {
73    if(ConstObject)
74       return ConstObject;
75    else
76       return GetObject();
77 }
78
79 void Command::SetText(const std::string &text)
80 {
81    Text = text;
82 }
83
84 const std::string &Command::GetText(void) const
85 {
86    return Text;
87 }
88
89 void Command::Execute()
90 {
91 }
92
93 const char *Command::GetCommandAsString(unsigned int command)
94 {
95    switch(command)
96    {
97       case CMD_UNKNOWN:
98          return "Unknown";
99       case CMD_DEBUG:
100          return "Debug";
101       case CMD_WARNING:
102          return "Warning";
103       case CMD_ERROR:
104          return "Error";
105       case CMD_ASSERT:
106          return "Assert";
107       case CMD_STARTPROGRESS:
108          return "StartProgress";
109       case CMD_ENDPROGRESS:
110          return "EndProgress";
111       case CMD_PROGRESS:
112          return "Progress";
113       default:
114          return "Undefined !!!";
115    }
116 }
117
118 //-----------------------------------------------------------------------------
119 // Protected
120
121 //-----------------------------------------------------------------------------
122 // Private
123
124 //-----------------------------------------------------------------------------
125 // Print
126
127 //-----------------------------------------------------------------------------
128 } // end namespace gdcm