53 assert( DictInternal.empty() );
56 friend std::ostream&
operator<<(std::ostream& _os,
const Dict &_val);
61 bool IsEmpty()
const {
return DictInternal.empty(); }
65 MapDictEntry::size_type s = DictInternal.size();
68 MapDictEntry::value_type(tag, de));
69 assert( s < DictInternal.size() );
74 MapDictEntry::const_iterator it =
75 DictInternal.find(tag);
76 if (it == DictInternal.end())
78 #ifdef UNKNOWNPUBLICTAG
80 if( tag !=
Tag(0x28,0x15)
81 && tag !=
Tag(0x28,0x16)
82 && tag !=
Tag(0x28,0x199)
84 && tag !=
Tag(0x20,0x1)
86 && tag !=
Tag(0x8348,0x339)
87 && tag !=
Tag(0xb5e8,0x338)
89 && tag !=
Tag(0x40,0xa125)
92 assert( 0 &&
"Impossible" );
95 it = DictInternal.find(
Tag(0xffff,0xffff) );
98 assert( DictInternal.count(tag) == 1 );
103 const char *GetKeywordFromTag(
Tag const & tag)
const
105 MapDictEntry::const_iterator it =
106 DictInternal.find(tag);
107 if (it == DictInternal.end())
111 assert( DictInternal.count(tag) == 1 );
112 return it->second.GetKeyword();
119 const DictEntry &GetDictEntryByKeyword(
const char *keyword,
Tag & tag)
const
121 MapDictEntry::const_iterator it =
122 DictInternal.begin();
125 for(; it != DictInternal.end(); ++it)
127 if( strcmp( keyword, it->second.GetKeyword() ) == 0 )
137 it = DictInternal.end();
139 if (it == DictInternal.end())
141 tag =
Tag(0xffff,0xffff);
142 it = DictInternal.find( tag );
145 assert( DictInternal.count(tag) == 1 );
154 MapDictEntry::const_iterator it =
155 DictInternal.begin();
158 for(; it != DictInternal.end(); ++it)
160 if( strcmp( name, it->second.GetName() ) == 0 )
170 it = DictInternal.end();
172 if (it == DictInternal.end())
174 tag =
Tag(0xffff,0xffff);
175 it = DictInternal.find( tag );
178 assert( DictInternal.count(tag) == 1 );
195 Dict::MapDictEntry::const_iterator it = val.DictInternal.begin();
196 for(;it != val.DictInternal.end(); ++it)
198 const Tag &t = it->first;
200 os << t <<
" " << de <<
'\n';
218 typedef std::map<PrivateTag, DictEntry> MapDictEntry;
226 MapDictEntry::size_type s = DictInternal.size();
229 MapDictEntry::value_type(tag, de));
232 #if defined(NDEBUG) && 0
233 if( s == DictInternal.size() )
235 MapDictEntry::iterator it =
236 DictInternal.find(tag);
237 assert( it != DictInternal.end() );
240 assert( de.
GetVR() != duplicate.GetVR() );
241 if( duplicate.GetVR() ==
VR::UN )
245 duplicate.SetVM( de.
GetVM() );
246 assert( GetDictEntry(tag).GetVR() !=
VR::UN );
247 assert( GetDictEntry(tag).GetVR() == de.
GetVR() );
248 assert( GetDictEntry(tag).GetVM() == de.
GetVM() );
253 assert( s < DictInternal.size() );
259 MapDictEntry::size_type s =
260 DictInternal.erase(tag);
261 assert( s == 1 || s == 0 );
266 MapDictEntry::const_iterator it =
267 DictInternal.find(tag);
268 if (it == DictInternal.end())
277 MapDictEntry::const_iterator it =
278 DictInternal.find(tag);
279 if (it == DictInternal.end())
282 it = DictInternal.find(
PrivateTag(0xffff,0xffff,
"GDCM Private Sentinel" ) );
283 assert (it != DictInternal.end());
286 assert( DictInternal.count(tag) == 1 );
291 void PrintXML()
const
293 MapDictEntry::const_iterator it = DictInternal.begin();
294 std::cout <<
"<dict edition=\"2008\">\n";
295 for(;it != DictInternal.end(); ++it)
299 std::cout <<
" <entry group=\"" << std::hex << std::setw(4)
300 << std::setfill(
'0') << t.
GetGroup() <<
"\"" <<
301 " element=\"xx" << std::setw(2) << std::setfill(
'0')<< t.
GetElement() <<
"\"" <<
" vr=\""
302 << de.
GetVR() <<
"\" vm=\"" << de.
GetVM() <<
"\" owner=\""
304 const char *name = de.
GetName();
307 std::cout <<
"\"/>\n";
311 std::cout <<
"\" name=\"" << de.
GetName() <<
"\"/>\n";
314 std::cout <<
"</dict>\n";
317 bool IsEmpty()
const {
return DictInternal.empty(); }
326 MapDictEntry DictInternal;
331 PrivateDict::MapDictEntry::const_iterator it = val.DictInternal.begin();
332 for(;it != val.DictInternal.end(); ++it)
336 os << t <<
" " << de <<
'\n';