]> Creatis software - gdcm.git/blob - src/gdcmDictEntry.cxx
Fix mistypings
[gdcm.git] / src / gdcmDictEntry.cxx
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: gdcmDictEntry.cxx,v $
5   Language:  C++
6   Date:      $Date: 2007/05/23 14:18:09 $
7   Version:   $Revision: 1.61 $
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 "gdcmDictEntry.h"
20 #include "gdcmDebug.h"
21 #include "gdcmUtil.h"
22
23 #include <iomanip> // for std::ios::left, ...
24 #include <fstream>
25 #include <stdio.h> // for sprintf
26
27 namespace GDCM_NAME_SPACE 
28 {
29 //-----------------------------------------------------------------------------
30 // Constructor / Destructor
31 /**
32  * \brief   Constructor
33  * @param   group      DICOM-Group Number
34  * @param   elem       DICOM-Element Number
35  * @param   vr         Value Representation
36  * @param   vm         Value Multiplicity 
37  * @param   name       description of the element
38 */
39 DictEntry::DictEntry(uint16_t group, uint16_t elem,
40                      VRKey const &vr, 
41                      TagName const &vm,
42                      TagName const &name)
43 {
44    Tag.SetGroup(group);
45    Tag.SetElement(elem);
46    VR      = vr;
47    VM      = vm;
48    Name    = name;
49 }
50
51 /**
52  * \brief   Destructor
53  */
54 DictEntry::~DictEntry()
55 {
56 }
57 //-----------------------------------------------------------------------------
58 // Public
59 /**
60  * \brief Class allocator
61  * @param   group      DICOM-Group Number
62  * @param   elem       DICOM-Element Number
63  * @param   vr         Value Representation
64  * @param   vm         Value Multiplicity 
65  * @param   name       description of the element
66 */
67 DictEntry *DictEntry::New(uint16_t group, uint16_t elem,
68                           VRKey const &vr,
69                           TagName const &vm,
70                           TagName const &name)
71 {
72    return new DictEntry(group,elem,vr,vm,name);
73 }
74
75 /**
76  * \brief   concatenates 2 uint16_t (supposed to be a Dicom group number 
77  *                                              and a Dicom element number)
78  * @param  group the Dicom group number used to build the tag
79  * @param  elem the Dicom element number used to build the tag
80  * @return the built tag
81  */
82 TagKey DictEntry::TranslateToKey(uint16_t group, uint16_t elem)
83 {
84    // according to 'Purify', TranslateToKey is one of the most
85    // time consuming methods.
86    // Let's try to shorten it !
87    return TagKey(group,elem);
88 }
89
90 //-----------------------------------------------------------------------------
91 // Protected
92
93 //-----------------------------------------------------------------------------
94 // Private
95
96 //-----------------------------------------------------------------------------
97 // Print
98 /**
99  * \brief   Prints an entry of the Dicom DictionaryEntry
100  * @param   os ostream we want to print in
101  * @param indent Indentation string to be prepended during printing
102  */
103 void DictEntry::Print(std::ostream &os, std::string const & )
104 {
105    os << GetKey(); 
106    os << " [" << VR  << "] ";
107
108    std::ostringstream s;
109
110    if ( PrintLevel >= 1 )
111    {
112       s.setf(std::ios::left);
113       s << std::setw(66-GetName().length()) << " ";
114    }
115
116    s << "[" << GetName()<< "]";
117    os << s.str() << std::endl;
118 }
119
120 //-----------------------------------------------------------------------------
121 } // end namespace gdcm
122