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)
21 //ListSQItem items est un *champ* de gdcmSeqEntry.
23 delimitor_mode = false;
28 * \ingroup gdcmSeqEntry
29 * \brief Canonical destructor.
31 gdcmSeqEntry::~gdcmSeqEntry() {
32 for(ListSQItem::iterator cc = items.begin();cc != items.end();++cc)
38 //-----------------------------------------------------------------------------
41 * \ingroup gdcmSeqEntry
42 * \brief canonical Printer
44 void gdcmSeqEntry::Print(std::ostream &os){
48 unsigned short int g, e;
51 char greltag[10]; //group element tag
56 // PrintCommonPart(os); // FIXME : why doesn't it work ?
58 // First, Print the Dicom Element itself.
63 sprintf(greltag,"%04x|%04x ",g,e);
65 if (GetPrintLevel()>=2) {
67 lgth = GetReadLength(); // ReadLength, as opposed to UsableLength
68 if (lgth == 0xffffffff) {
69 sprintf(st,"x(ffff)"); // I said : "x(ffff)" !
70 s.setf(std::ios::left);
71 s << std::setw(10-strlen(st)) << " ";
73 s.setf(std::ios::left);
74 s << std::setw(8) << "-1";
76 sprintf(st,"x(%x)",lgth);
77 s.setf(std::ios::left);
78 s << std::setw(10-strlen(st)) << " ";
80 s.setf(std::ios::left);
81 s << std::setw(8) << lgth;
84 sprintf(st,"x(%x)",o);
85 s << std::setw(10-strlen(st)) << " ";
87 s << std::setw(8) << o;
90 s << "[" << vr << "] ";
91 if (GetPrintLevel()>=1) {
92 s.setf(std::ios::left);
93 s << std::setw(66-GetName().length()) << " ";
96 s << "[" << GetName()<< "]";
102 // Then, Print each SQ Item
103 for(ListSQItem::iterator cc = items.begin();cc != items.end();++cc)
105 //(*cc)->SetPrintLevel(GetPrintLevel()); aurait-ce un sens ?
108 // at end, print the sequence terminator item, if any
110 if (delimitor_mode) {
119 //-----------------------------------------------------------------------------
122 /// \brief adds the passed ITEM to the ITEM chained List for this SeQuence.
123 void gdcmSeqEntry::AddEntry(gdcmSQItem *sqItem) {
124 items.push_back(sqItem);
126 //-----------------------------------------------------------------------------
129 //-----------------------------------------------------------------------------
132 // end-user intended : the guy *wants* to create his own SeQuence ?!?
133 gdcmDocEntry *gdcmSeqEntry::NewDocEntryByNumber(guint16 group,
140 gdcmDocEntry *gdcmSeqEntry::NewDocEntryByName (std::string Name) {
145 //-----------------------------------------------------------------------------