1 /*=========================================================================
4 Module: $RCSfile: gdcmDictEntry.cxx,v $
6 Date: $Date: 2005/10/27 14:12:24 $
7 Version: $Revision: 1.55 $
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)
76 DicomEntry::SetVR(vr);
80 gdcmErrorMacro( "Overwriting VR might compromise a dictionary");
85 * \brief If-and only if-the V(alue) M(ultiplicity)
86 * \ is unset then overwrite it.
87 * @param vm New V(alue) M(ultiplicity) to be set.
89 void DictEntry::SetVM(TagName const &vm)
97 gdcmErrorMacro( "Overwriting VM might compromise a dictionary");
101 //-----------------------------------------------------------------------------
104 //-----------------------------------------------------------------------------
107 //-----------------------------------------------------------------------------
110 * \brief Prints an entry of the Dicom DictionaryEntry
111 * @param os ostream we want to print in
112 * @param indent Indentation string to be prepended during printing
114 void DictEntry::Print(std::ostream &os, std::string const &indent )
116 DicomEntry::Print(os,indent);
118 std::ostringstream s;
120 if ( PrintLevel >= 1 )
122 s.setf(std::ios::left);
123 s << std::setw(66-GetName().length()) << " ";
126 s << "[" << GetName()<< "]";
127 os << s.str() << std::endl;
130 //-----------------------------------------------------------------------------
131 } // end namespace gdcm