]> Creatis software - gdcm.git/blob - src/gdcmSQItem.h
STYLE: ivars should start with a capital letter. Accessors should be const to avoid...
[gdcm.git] / src / gdcmSQItem.h
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: gdcmSQItem.h,v $
5   Language:  C++
6   Date:      $Date: 2004/10/25 03:35:20 $
7   Version:   $Revision: 1.21 $
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
26 namespace gdcm 
27 {
28 class DocEntry;
29
30 //-----------------------------------------------------------------------------
31 typedef std::list<DocEntry *> ListDocEntry;
32 //-----------------------------------------------------------------------------
33 class GDCM_EXPORT SQItem : public DocEntrySet 
34 {
35 public:
36    SQItem(int depthLevel);
37    ~SQItem();
38
39    void Print(std::ostream &os = std::cout); 
40    void Write(std::ofstream *fp, FileType filetype);
41
42    /// \brief   returns the DocEntry chained List for this SQ Item.
43    ListDocEntry const &GetDocEntries() const { return DocEntries; };
44    
45    /// \brief   adds the passed DocEntry to the DocEntry chained List for
46    /// this SQ Item.      
47    void AddDocEntry(DocEntry *e) { DocEntries.push_back(e); };
48
49    virtual bool AddEntry(DocEntry *Entry); // add to the List
50   
51    DocEntry *GetDocEntryByNumber(uint16_t group, uint16_t element);
52    // FIXME method to write
53    //DocEntry *GetDocEntryByName  (std::string Name);
54    
55    bool SetEntryByNumber(std::string const & val, uint16_t group, uint16_t element);                   
56     
57    std::string GetEntryByNumber(uint16_t group, uint16_t element);
58
59    /// \brief   returns the ordinal position of a given SQItem
60    int GetSQItemNumber() { return SQItemNumber; };
61
62    /// \brief   Sets the ordinal position of a given SQItem
63    void SetSQItemNumber(int itemNumber) { SQItemNumber = itemNumber; };
64
65    /// Accessor on \ref SQDepthLevel.
66    int GetDepthLevel() { return SQDepthLevel; }
67                                                                                 
68    /// Accessor on \ref SQDepthLevel.
69    void SetDepthLevel(int depth) { SQDepthLevel = depth; }
70
71    /// Accessor on \ref BaseTagKey.
72    void           SetBaseTagKey( BaseTagKey const & key ) { BaseTagKeyNested = key; }
73
74    /// Accessor on \ref BaseTagKey.
75    BaseTagKey const & GetBaseTagKey() const { return BaseTagKeyNested; }
76
77
78 protected:
79 // Variables that need to be access in subclasses
80
81    /// \brief chained list of (Elementary) Doc Entries
82    ListDocEntry DocEntries;
83    
84    ///\brief pointer to the HTable of the Document,
85    ///       (because we don't know it within any DicomDirObject nor any SQItem)
86    TagDocEntryHT *PtagHT;
87
88 private:
89
90    /// \brief Sequences can be nested. This \ref SQDepthLevel represents
91    ///        the level of the nesting of instances of this class.
92    ///        \ref SQDepthLevel and its \ref SeqEntry::SQDepthLevel
93    ///        counterpart are only defined on printing purposes
94    ///        (see \ref Print).
95    int SQDepthLevel;
96
97    /// \brief A TagKey of a DocEntry nested in a sequence is prepended
98    ///        with this BaseTagKey.
99    BaseTagKey BaseTagKeyNested;
100
101  
102    /// \brief SQ Item ordinal number 
103    int SQItemNumber;
104
105 };
106 } // end namespace gdcm
107 //-----------------------------------------------------------------------------
108 #endif