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