]> Creatis software - gdcm.git/blob - src/gdcmSQItem.h
Fix mistypings
[gdcm.git] / src / gdcmSQItem.h
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: gdcmSQItem.h,v $
5   Language:  C++
6   Date:      $Date: 2007/09/17 12:16:01 $
7   Version:   $Revision: 1.56 $
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 #ifndef _GDCMSQITEM_H_
19 #define _GDCMSQITEM_H_
20
21 #include "gdcmDocEntrySet.h"
22 #include "gdcmElementSet.h"
23
24 #include <list>
25 #include <fstream>
26
27 namespace GDCM_NAME_SPACE 
28 {
29 class DocEntry;
30
31 //-----------------------------------------------------------------------------
32 typedef std::list<DocEntry *> ListDocEntry;
33
34 //-----------------------------------------------------------------------------
35 /**
36  * \brief a SeqEntry is composed by a set of SQItems.
37  *        Each SQItem is composed by a set of DocEntry
38  *        A DocEntry may be a SeqEntry
39  *        ... and so forth 
40  */ 
41 class GDCM_EXPORT SQItem : public DocEntrySet 
42 {
43    gdcmTypeMacro(SQItem);
44
45 public:
46    static SQItem *New(int depthLevel) {return new SQItem(depthLevel);}
47
48    virtual void Print(std::ostream &os = std::cout, 
49                       std::string const &indent = "" ); 
50    void WriteContent(std::ofstream *fp, FileType filetype,
51                            bool insideMetaElements, bool insideSequence);
52    uint32_t ComputeFullLength();
53
54    bool AddEntry(DocEntry *Entry); // add to the List
55    bool RemoveEntry(DocEntry *EntryToRemove);
56    void ClearEntry();
57   
58    DocEntry *GetFirstEntry();
59    DocEntry *GetNextEntry();
60
61    DocEntry *GetDocEntry(uint16_t group, uint16_t elem);
62
63    bool IsEmpty() { return DocEntries.empty(); }
64
65    /// \brief   returns the ordinal position of a given SQItem
66    int GetSQItemNumber() { return SQItemNumber; }
67    /// \brief   Sets the ordinal position of a given SQItem
68    void SetSQItemNumber(int itemNumber) { SQItemNumber = itemNumber; }
69
70    ///  \brief Accessor on  SQDepthLevel.
71    int GetDepthLevel() { return SQDepthLevel; }                                                                             
72
73    ///  \brief Accessor on  SQDepthLevel.
74    void SetDepthLevel(int depth) { SQDepthLevel = depth; }
75
76    virtual void Copy(DocEntrySet *set);
77
78 protected:
79    SQItem(int depthLevel);
80    ~SQItem();
81
82 // Variables that need to be accessed in subclasses
83    /// \brief Chained list of Doc Entries
84    ListDocEntry DocEntries;
85    /// Iterator, used to visit the entries
86    ListDocEntry::iterator ItDocEntries;
87   
88 private:
89    /// \brief Sequences can be nested. This  SQDepthLevel represents
90    ///        the level of the nesting of instances of this class.
91    ///         SQDepthLevel and its  SeqEntry::SQDepthLevel
92    ///        counterpart are only defined on printing purposes
93    ///        (see  Print).
94    int SQDepthLevel;
95
96    /// \brief SQ Item ordinal number 
97    int SQItemNumber;
98 };
99 } // end namespace gdcm
100 //-----------------------------------------------------------------------------
101 #endif