71 assert( DES.empty() );
78 void Print(std::ostream &os, std::string
const &indent =
"")
const {
85 for( ; it != DES.end(); ++it)
87 os << indent << *it <<
"\n";
91 template <
typename TDE>
92 unsigned int ComputeGroupLength(
Tag const &tag)
const
98 for( ++it; it != DES.end()
99 && it->GetTag().GetGroup() == tag.
GetGroup(); ++it)
101 assert( it->GetTag().GetElement() != 0x0 );
102 assert( it->GetTag().GetGroup() == tag.
GetGroup() );
103 res += it->GetLength<TDE>();
108 template <
typename TDE>
110 if( DES.empty() )
return 0;
111 assert( !DES.empty() );
115 for( ; it != DES.end(); ++it)
117 assert( !(it->GetLength<TDE>().IsUndefined()) );
118 if ( it->GetTag() !=
Tag(0xfffe,0xe00d) )
120 ll += it->GetLength<TDE>();
140 InsertDataElement( de );
145 gdcmErrorMacro(
"Cannot add element with group < 0x0008 and != 0x4 in the dataset: " << de.
GetTag() );
150 if( DES.find(de) != DES.end() ) DES.erase(de);
156 if( it != DES.end() && it->IsEmpty() )
162 DataElementSet::size_type count = DES.erase(tag);
163 assert( count == 0 || count == 1 );
180 if( it != DES.end() )
185 const DataElement& operator() (uint16_t group, uint16_t element)
const {
return GetDataElement(
Tag(group,element) ); }
188 std::string GetPrivateCreator(
const Tag &t)
const;
191 bool FindDataElement(
const PrivateTag &t)
const;
199 if( DES.find(r) != DES.end() )
211 if( it != DES.end() )
238 template <
typename TDE,
typename TSwap>
239 std::istream &ReadNested(std::istream &is);
241 template <
typename TDE,
typename TSwap>
242 std::istream &Read(std::istream &is);
244 template <
typename TDE,
typename TSwap>
245 std::istream &ReadUpToTag(std::istream &is,
const Tag &t, std::set<Tag>
const & skiptags);
247 template <
typename TDE,
typename TSwap>
248 std::istream &ReadUpToTagWithLength(std::istream &is,
const Tag &t,
VL & length);
250 template <
typename TDE,
typename TSwap>
251 std::istream &ReadSelectedTags(std::istream &is,
const std::set<Tag> & tags);
252 template <
typename TDE,
typename TSwap>
253 std::istream &ReadSelectedTagsWithLength(std::istream &is,
const std::set<Tag> & tags,
VL & length);
255 template <
typename TDE,
typename TSwap>
256 std::ostream
const &Write(std::ostream &os)
const;
258 template <
typename TDE,
typename TSwap>
259 std::istream &ReadWithLength(std::istream &is,
VL &length);
275 std::pair<Iterator,bool> pr = DES.insert(de);
276 if( pr.second ==
false )
278 gdcmWarningMacro(
"DataElement: " << de <<
" was already found, skipping duplicate entry.\n"
279 "Original entry kept is: " << *pr.first );
304 #if defined(SWIGPYTHON) || defined(SWIGCSHARP) || defined(SWIGJAVA)
312 SWIGDataSet(DataSet &des):Internal(des),it(des.Begin()) {}
313 const DataElement& GetCurrent()
const {
return *it; }
314 void Start() { it = Internal.Begin(); }
315 bool IsAtEnd()
const {
return it == Internal.End(); }
316 void Next() { ++it; }
330 #include "gdcmDataSet.txx"
332 #endif //GDCMDATASET_H