]> Creatis software - gdcm.git/blob - src/gdcmSeqEntry.h
BUG: Remove the Print indent mess. Please only one Print per class default paramater...
[gdcm.git] / src / gdcmSeqEntry.h
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: gdcmSeqEntry.h,v $
5   Language:  C++
6   Date:      $Date: 2005/01/16 04:50:42 $
7   Version:   $Revision: 1.28 $
8                                                                                 
9   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10   l'Image). All rights reserved. See Doc/License.txt or
11   http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
12                                                                                 
13      This software is distributed WITHOUT ANY WARRANTY; without even
14      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15      PURPOSE.  See the above copyright notices for more information.
16                                                                                 
17 =========================================================================*/
18
19 #ifndef GDCMSQDOCENTRY_H
20 #define GDCMSQDOCENTRY_H
21
22 #include "gdcmDocEntry.h"
23
24 #include <list>
25
26 namespace gdcm 
27 {
28 class SQItem;
29 //-----------------------------------------------------------------------------
30 typedef std::list<SQItem *> ListSQItem;
31 //-----------------------------------------------------------------------------
32 /**
33  * \brief a SeqEntry (as opposed to a ValEntry) is a non elementary DocEntry.
34  *        It is composed by a set of SQItems.
35  *        Each SQItem is composed by a set of DocEntry
36  *        A DocEntry may be a SeqEntry
37  *        ... and so forth 
38  */ 
39 class GDCM_EXPORT SeqEntry : public DocEntry 
40 {
41 public:
42    SeqEntry( DictEntry *e);
43    SeqEntry( DocEntry *d, int depth );
44    ~SeqEntry();
45    
46    void Print(std::ostream &os = std::cout, std::string const & indent = "" ); 
47    void WriteContent(std::ofstream *fp, FileType filetype);
48
49    /// returns the SQITEM chained List for this SeQuence.
50    ListSQItem const &GetSQItems() const { return Items; }
51       
52    /// Sets the delimitor mode
53    void SetDelimitorMode(bool dm) { DelimitorMode = dm; }
54
55    /// Sets the Sequence Delimitation Item
56    void SetSequenceDelimitationItem(DocEntry *e) { SeqTerm = e;}
57
58    void AddEntry(SQItem *it, int itemNumber);
59    SQItem *GetSQItemByOrdinalNumber(int itemNumber);
60
61    /// Gets the depth level
62    int GetDepthLevel() const { return SQDepthLevel; }
63
64    /// Sets the depth level of a Sequence Entry embedded in a SeQuence
65    void SetDepthLevel(int depth) { SQDepthLevel = depth; }
66
67 protected:
68
69 private:
70 // Variables
71
72    /// If this Sequence is in delimitor mode (length =0xffffffff) or not
73    bool DelimitorMode;
74    
75    /// Chained list of SQ Items
76    ListSQItem Items;
77    
78    /// sequence terminator item 
79    DocEntry *SeqTerm;
80
81    /// \brief Defines the depth level of this \ref SeqEntry inside
82    ///        the (optionaly) nested sequences. \ref SQDepthLevel
83    ///        and its \ref SQItem::SQDepthLevel counterpart
84    ///        are only defined on printing purposes (see \ref Print).
85    int SQDepthLevel;
86 };
87 } // end namespace gdcm
88 //-----------------------------------------------------------------------------
89 #endif
90