1 /*=========================================================================
4 Module: $RCSfile: gdcmDictEntry.cxx,v $
6 Date: $Date: 2005/11/28 15:30:04 $
7 Version: $Revision: 1.56 $
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 =========================================================================*/
19 #include "gdcmDictEntry.h"
20 #include "gdcmDebug.h"
23 #include <iomanip> // for std::ios::left, ...
25 #include <stdio.h> // for sprintf
29 //-----------------------------------------------------------------------------
30 // Constructor / Destructor
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
39 DictEntry::DictEntry(uint16_t group, uint16_t elem,
43 DicomEntry(group,elem,vr)
49 //-----------------------------------------------------------------------------
52 * \brief Class allocator
53 * @param group DICOM-Group Number
54 * @param elem DICOM-Element Number
55 * @param vr Value Representation
56 * @param vm Value Multiplicity
57 * @param name description of the element
59 DictEntry *DictEntry::New(uint16_t group, uint16_t elem,
64 return new DictEntry(group,elem,vr,vm,name);
68 * \brief If-and only if-the V(alue) R(epresentation)
69 * \ is unset then overwrite it.
70 * @param vr New V(alue) R(epresentation) to be set.
72 void DictEntry::SetVR(VRKey const &vr)
74 gdcmAssertMacro( IsVRUnknown() );
75 DicomEntry::SetVR(vr);
79 * \brief If-and only if-the V(alue) M(ultiplicity)
80 * \ is unset then overwrite it.
81 * @param vm New V(alue) M(ultiplicity) to be set.
83 void DictEntry::SetVM(TagName const &vm)
85 gdcmAssertMacro( IsVMUnknown() );
89 //-----------------------------------------------------------------------------
92 //-----------------------------------------------------------------------------
95 //-----------------------------------------------------------------------------
98 * \brief Prints an entry of the Dicom DictionaryEntry
99 * @param os ostream we want to print in
100 * @param indent Indentation string to be prepended during printing
102 void DictEntry::Print(std::ostream &os, std::string const &indent )
104 DicomEntry::Print(os,indent);
106 std::ostringstream s;
108 if ( PrintLevel >= 1 )
110 s.setf(std::ios::left);
111 s << std::setw(66-GetName().length()) << " ";
114 s << "[" << GetName()<< "]";
115 os << s.str() << std::endl;
118 //-----------------------------------------------------------------------------
119 } // end namespace gdcm