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