2 //-----------------------------------------------------------------------------
4 #include "gdcmSeqEntry.h"
5 #include "gdcmSQItem.h"
7 #include "gdcmGlobal.h"
12 //-----------------------------------------------------------------------------
13 // Constructor / Destructor
15 * \ingroup gdcmSeqEntry
16 * \brief Constructor from a given gdcmSeqEntry
18 gdcmSeqEntry::gdcmSeqEntry(gdcmDictEntry* e, int depth)
21 delimitor_mode = false;
27 * \ingroup gdcmSeqEntry
28 * \brief Canonical destructor.
30 gdcmSeqEntry::~gdcmSeqEntry() {
31 for(ListSQItem::iterator cc = items.begin();cc != items.end();++cc)
39 //-----------------------------------------------------------------------------
42 * \ingroup gdcmSeqEntry
43 * \brief canonical Printer
45 void gdcmSeqEntry::Print(std::ostream &os){
47 std::ostringstream s,s2;
49 unsigned short int g, e;
52 char greltag[10]; //group element tag
55 // First, Print the Dicom Element itself.
61 // Then, Print each SQ Item
62 for(ListSQItem::iterator cc = items.begin();cc != items.end();++cc)
66 // at end, print the sequence terminator item, if any
70 for (int i=0;i<SQDepthLevel;i++)
74 if (seq_term != NULL) {
79 << " -------------- should have a sequence terminator item"
84 //-----------------------------------------------------------------------------
87 /// \brief adds the passed ITEM to the ITEM chained List for this SeQuence.
88 void gdcmSeqEntry::AddEntry(gdcmSQItem *sqItem, int itemNumber) {
89 sqItem->SetSQItemNumber(itemNumber);
90 items.push_back(sqItem);
93 /// \brief Sets the depth level of a Sequence Entry embedded in a SeQuence
94 void gdcmSeqEntry::SetDepthLevel(int depth) {
98 /// \brief return a pointer to th SQItem referenced by its ordinal number
99 /// (returns the first one if ordinal number is <0
100 /// returns the last one if ordinal number is > item number
102 gdcmSQItem *gdcmSeqEntry::GetSQItemByOrdinalNumber(int nb) {
104 return (*(items.begin()));
106 for(ListSQItem::iterator cc = items.begin();
112 return (*(items.end()));
114 //-----------------------------------------------------------------------------
118 //-----------------------------------------------------------------------------
121 //-----------------------------------------------------------------------------