]> Creatis software - gdcm.git/blob - src/gdcmSeqEntry.h
Fix mistypings
[gdcm.git] / src / gdcmSeqEntry.h
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: gdcmSeqEntry.h,v $
5   Language:  C++
6   Date:      $Date: 2007/09/17 12:16:01 $
7   Version:   $Revision: 1.47 $
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_NAME_SPACE 
27 {
28 class SQItem;
29 //-----------------------------------------------------------------------------
30 typedef std::list<SQItem *> ListSQItem;
31
32 //-----------------------------------------------------------------------------
33 /**
34  * \brief a SeqEntry (as opposed to a DataEntry) is a non elementary DocEntry.
35  *        It is composed by a set of SQItems.
36  *        Each SQItem is composed by a set of DocEntry
37  *        A DocEntry may be a SeqEntry
38  *        ... and so forth 
39  */ 
40 class GDCM_EXPORT SeqEntry : public DocEntry 
41 {
42    gdcmTypeMacro(SeqEntry);
43
44 public:
45 /// \brief Contructs a SeqEntry with a RefCounter from DictEntry
46    //static SeqEntry *New(DictEntry *e) {return new SeqEntry(e);}
47 /// \brief Contructs a SeqEntry with a RefCounter from DocEntry
48    static SeqEntry *New(DocEntry *d, int depth) {return new SeqEntry(d,depth);}
49 /// \brief Constructs a SeqEntry with a RefCounter from elementary values
50    static SeqEntry *New(uint16_t group,uint16_t elem/*, VRKey const &vr = GDCM_VRUNKNOWN*/) 
51                            {return new SeqEntry(group,elem);}
52    
53    void Print(std::ostream &os = std::cout, std::string const &indent = "" ); 
54    void WriteContent(std::ofstream *fp, FileType filetype,
55                      bool insideMetaElements, bool insideSequence);
56    uint32_t ComputeFullLength();
57
58    void AddSQItem(SQItem *it, int itemNumber);
59    void ClearSQItem();
60    SQItem *GetFirstSQItem();
61    SQItem *GetNextSQItem();
62    SQItem *GetSQItem(int itemNumber);
63    unsigned int GetNumberOfSQItems();
64       
65    /// Sets the delimitor mode
66    void SetDelimitorMode(bool dm) { DelimitorMode = dm; }
67    /// Sets the Sequence Delimitation Item
68    void SetDelimitationItem(DocEntry *e);
69
70    /// Gets the Sequence Delimitation Item
71    DocEntry *GetDelimitationItem() { return SeqTerm;}
72
73    /// Gets the depth level
74    int GetDepthLevel() const { return SQDepthLevel; }
75    /// Sets the depth level of a Sequence Entry embedded in a SeQuence
76    void SetDepthLevel(int depth) { SQDepthLevel = depth; }
77
78    virtual void Copy(DocEntry *doc);
79
80 protected:
81
82 private:
83    //SeqEntry( DictEntry *e);
84    SeqEntry( DocEntry *d, int depth );
85    SeqEntry( uint16_t group, uint16_t elem );
86    ~SeqEntry();
87
88 // Variables
89    /// If this Sequence is in delimitor mode (length =0xffffffff) or not
90    bool DelimitorMode;
91    
92    /// Chained list of SQ Items
93    ListSQItem Items;
94    /// iterator on the SQItems of the current SeqEntry
95    ListSQItem::iterator ItSQItem;
96
97    /// sequence terminator item 
98    DocEntry *SeqTerm;
99
100    /// \brief Defines the depth level of this  SeqEntry inside
101    ///        the (optionaly) nested sequences.  SQDepthLevel
102    ///        and its  SQItem::SQDepthLevel counterpart
103    ///        are only defined on printing purposes (see  Print).
104    int SQDepthLevel;
105 };
106 } // end namespace gdcm
107 //-----------------------------------------------------------------------------
108 #endif
109