]> Creatis software - gdcm.git/blob - src/gdcmDocEntrySet.h
* Preparation of writing a gdcmHeader iterator: generalisation of gdcmTagKey
[gdcm.git] / src / gdcmDocEntrySet.h
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: gdcmDocEntrySet.h,v $
5   Language:  C++
6   Date:      $Date: 2004/09/13 12:10:53 $
7   Version:   $Revision: 1.16 $
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
19 #ifndef GDCMDOCENTRYSET_H
20 #define GDCMDOCENTRYSET_H
21
22 #include "gdcmException.h"
23 #include "gdcmDocEntry.h"
24  
25 typedef std::string gdcmBaseTagKey;
26 //-----------------------------------------------------------------------------
27
28 class GDCM_EXPORT gdcmDocEntrySet
29 {
30 public:
31
32    gdcmDocEntrySet(int depth = 0); 
33    virtual ~gdcmDocEntrySet();
34
35    /// \brief adds any type of entry to the entry set (pure vitual)
36    virtual bool AddEntry(gdcmDocEntry *Entry) = 0; // pure virtual
37  
38    /// \brief prints any type of entry to the entry set (pure vitual)
39    virtual void Print (std::ostream & os = std::cout) = 0;// pure virtual
40
41    /// \brief write any type of entry to the entry set
42    virtual void Write (FILE *fp, FileType filetype) = 0;// pure virtual
43
44    /// \brief Gets the depth level of a Dicom Header Entry embedded in a
45    ///        SeQuence
46    int GetDepthLevel() { return SQDepthLevel; }
47
48    /// \brief Sets the depth level of a Dicom Header Entry embedded in a
49    /// SeQuence
50    void SetDepthLevel(int depth) { SQDepthLevel = depth; }
51
52    void           SetBaseTagKey( gdcmBaseTagKey key ) { BaseTagKey = key; }
53    gdcmBaseTagKey GetBaseTagKey( ) { return BaseTagKey; }
54
55    virtual gdcmDocEntry* GetDocEntryByNumber(uint16_t group,
56                                              uint16_t element) = 0;
57    gdcmDocEntry *GetDocEntryByName(std::string const & name);
58    virtual std::string GetEntryByNumber(uint16_t group,uint16_t element) = 0;
59    std::string GetEntryByName(TagName const & name);
60    gdcmDictEntry *NewVirtualDictEntry(uint16_t group, 
61                                       uint16_t element,
62                                       std::string const & vr     = "unkn",
63                                       std::string const & fourth = "unkn",
64                                       std::string const & name   = "unkn");
65   
66 protected:
67
68 // DocEntry  related utilities 
69    gdcmValEntry* NewValEntryByNumber(uint16_t group, 
70                                      uint16_t element);
71    gdcmBinEntry* NewBinEntryByNumber(uint16_t group, 
72                                      uint16_t element);
73    gdcmDocEntry* NewDocEntryByNumber(uint16_t group, 
74                                      uint16_t element); 
75    gdcmDocEntry* NewDocEntryByName  (std::string const & name);
76    gdcmSeqEntry* NewSeqEntryByNumber(uint16_t group, 
77                                      uint16_t element);
78
79 // DictEntry  related utilities
80    gdcmDictEntry *GetDictEntryByName  (std::string const & name);
81    gdcmDictEntry *GetDictEntryByNumber(uint16_t, uint16_t);
82
83    /// Gives the depth level of the element set inside SeQuences   
84    int SQDepthLevel;
85
86    /// \brief A TagKey of a gdcmDocEntry nested in a sequence is prepended
87    ///        with this BaseTagKey.
88    gdcmBaseTagKey BaseTagKey;
89 private:
90 };
91
92
93 //-----------------------------------------------------------------------------
94 #endif
95