1 /*=========================================================================
4 Module: $RCSfile: gdcmDictGroupName.cxx,v $
6 Date: $Date: 2005/04/05 10:56:25 $
7 Version: $Revision: 1.1 $
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"
29 //-----------------------------------------------------------------------------
30 /// \brief auto generated function, to fill up the 'Value Representation'
31 /// Dictionnary, if relevant file is not found on user's disk
32 void FillDefaultDictGroupName(DictGroupNameHT &groupName);
34 //-----------------------------------------------------------------------------
35 // Constructor / Destructor
39 DictGroupName::DictGroupName()
41 std::string filename = DictSet::BuildDictPath() + DICT_GROUP_NAME;
42 std::ifstream from(filename.c_str());
45 gdcmWarningMacro("Can't open dictionary" << filename.c_str());
46 FillDefaultDictGroupName(groupName);
60 from.getline(buff, 1024, '"');
61 from.getline(buff, 1024, '"');
64 groupName[key] = value;
66 from.getline(buff, 1024, '\n');
75 DictGroupName::~DictGroupName()
80 //-----------------------------------------------------------------------------
82 const GroupName &DictGroupName::GetName(uint16_t group)
84 DictGroupNameHT::const_iterator it = groupName.find(group);
85 if (it == groupName.end())
92 //-----------------------------------------------------------------------------
95 //-----------------------------------------------------------------------------
98 //-----------------------------------------------------------------------------
102 * @param os The output stream to be written to.
104 void DictGroupName::Print(std::ostream &os)
106 std::ostringstream s;
108 for (DictGroupNameHT::iterator it = groupName.begin(); it != groupName.end(); ++it)
110 s << "DictGroupName : " << std::hex << it->first << std::dec
111 << " = " << it->second << std::endl;
116 //-----------------------------------------------------------------------------
117 } // end namespace gdcm