1 /*=========================================================================
4 Module: $RCSfile: gdcmDictGroupName.cxx,v $
6 Date: $Date: 2005/06/24 10:55:58 $
7 Version: $Revision: 1.4 $
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 "gdcmDictGroupName.h"
21 #include "gdcmDictSet.h"
22 #include "gdcmDebug.h"
30 //-----------------------------------------------------------------------------
31 /// \brief auto generated function, to fill up the 'Value Representation'
32 /// Dictionnary, if relevant file is not found on user's disk
33 void FillDefaultDictGroupName(DictGroupNameHT &groupName);
35 //-----------------------------------------------------------------------------
36 // Constructor / Destructor
40 DictGroupName::DictGroupName()
42 std::string filename = DictSet::BuildDictPath() + DICT_GROUP_NAME;
43 std::ifstream from(filename.c_str());
46 gdcmWarningMacro("Can't open dictionary" << filename.c_str());
47 FillDefaultDictGroupName(groupName);
61 from.getline(buff, 1024, '"');
62 from.getline(buff, 1024, '"');
65 groupName[key] = value;
67 from.getline(buff, 1024, '\n');
76 DictGroupName::~DictGroupName()
81 //-----------------------------------------------------------------------------
83 const TagName &DictGroupName::GetName(uint16_t group)
85 DictGroupNameHT::const_iterator it = groupName.find(group);
86 if ( it == groupName.end() )
93 //-----------------------------------------------------------------------------
96 //-----------------------------------------------------------------------------
99 //-----------------------------------------------------------------------------
103 * @param os The output stream to be written to.
105 void DictGroupName::Print(std::ostream &os)
107 std::ostringstream s;
109 for (DictGroupNameHT::iterator it = groupName.begin(); it != groupName.end(); ++it)
111 s << "DictGroupName : 0x" << std::hex << std::setw(4) << it->first
112 << std::dec << " = " << it->second << std::endl;
117 //-----------------------------------------------------------------------------
118 } // end namespace gdcm