72 assert( DES.empty() );
79 void Print(std::ostream &os, std::string
const &indent =
"")
const {
86 for( ; it != DES.end(); ++it)
88 os << indent << *it <<
"\n";
92 template <
typename TDE>
99 for( ++it; it != DES.end()
100 && it->GetTag().GetGroup() == tag.
GetGroup(); ++it)
102 assert( it->GetTag().GetElement() != 0x0 );
103 assert( it->GetTag().GetGroup() == tag.
GetGroup() );
104 res += it->GetLength<TDE>();
109 template <
typename TDE>
111 if( DES.empty() )
return 0;
112 assert( !DES.empty() );
116 for( ; it != DES.end(); ++it)
118 assert( !(it->GetLength<TDE>().IsUndefined()) );
119 if ( it->GetTag() !=
Tag(0xfffe,0xe00d) )
121 ll += it->GetLength<TDE>();
141 InsertDataElement( de );
146 gdcmErrorMacro(
"Cannot add element with group < 0x0008 and != 0x4 in the dataset: " << de.
GetTag() );
151 if( DES.find(de) != DES.end() ) DES.erase(de);
157 if( it != DES.end() && it->IsEmpty() )
163 DataElementSet::size_type count = DES.erase(tag);
164 assert( count == 0 || count == 1 );
181 if( it != DES.end() )
186 const DataElement& operator() (uint16_t group, uint16_t element)
const {
return GetDataElement(
Tag(group,element) ); }
189 std::string GetPrivateCreator(
const Tag &t)
const;
192 bool FindDataElement(
const PrivateTag &t)
const;
200 if( DES.find(r) != DES.end() )
212 if( it != DES.end() )
239 template <
typename TDE,
typename TSwap>
240 std::istream &ReadNested(std::istream &is);
242 template <
typename TDE,
typename TSwap>
243 std::istream &Read(std::istream &is);
245 template <
typename TDE,
typename TSwap>
246 std::istream &ReadUpToTag(std::istream &is,
const Tag &t, std::set<Tag>
const & skiptags);
248 template <
typename TDE,
typename TSwap>
249 std::istream &ReadUpToTagWithLength(std::istream &is,
const Tag &t,
VL & length);
251 template <
typename TDE,
typename TSwap>
252 std::istream &ReadSelectedTags(std::istream &is,
const std::set<Tag> & tags);
253 template <
typename TDE,
typename TSwap>
254 std::istream &ReadSelectedTagsWithLength(std::istream &is,
const std::set<Tag> & tags,
VL & length);
256 template <
typename TDE,
typename TSwap>
257 std::ostream
const &Write(std::ostream &os)
const;
259 template <
typename TDE,
typename TSwap>
260 std::istream &ReadWithLength(std::istream &is,
VL &length);
278 std::pair<Iterator,bool> pr = DES.insert(de);
279 if( pr.second ==
false )
281 gdcmWarningMacro(
"DataElement: " << de <<
" was already found, skipping duplicate entry.\n"
282 "Original entry kept is: " << *pr.first );
307 #if defined(SWIGPYTHON) || defined(SWIGCSHARP) || defined(SWIGJAVA)
315 SWIGDataSet(DataSet &des):Internal(des),it(des.Begin()) {}
316 const DataElement& GetCurrent()
const {
return *it; }
317 void Start() { it = Internal.Begin(); }
318 bool IsAtEnd()
const {
return it == Internal.End(); }
319 void Next() { ++it; }
333 #include "gdcmDataSet.txx"
335 #endif //GDCMDATASET_H