]> Creatis software - gdcm.git/blob - src/gdcmElValSet.h
* To remove warnings
[gdcm.git] / src / gdcmElValSet.h
1 // gdcmElValSet.h
2 //-----------------------------------------------------------------------------
3 #ifndef GDCMELVALSET_H
4 #define GDCMELVALSET_H
5
6 #include "gdcmCommon.h"
7 #include "gdcmElValue.h"
8
9 #include <stdio.h>
10 #include <map>
11 #include <list>       // for linking together *all* the Dicom Elements
12
13 //-----------------------------------------------------------------------------
14 typedef std::multimap<TagKey, gdcmElValue*> TagElValueHT;
15 typedef std::pair<TagKey, gdcmElValue*> PairHT;
16 typedef std::pair<TagElValueHT::iterator,TagElValueHT::iterator> IterHT; 
17
18 typedef std::list<gdcmElValue*> ListTag; // for linking together the Elements
19
20 // TODO : to be removed after re-writting   gdcmElValSet::UpdateGroupLength
21 //          using the chained list instead of the H table
22 typedef std::string GroupKey;
23 typedef std::map<GroupKey, int> GroupHT;
24
25 //-----------------------------------------------------------------------------
26 /*
27  * Container for a set of successfully parsed ElValues (i.e. Dicom Elements).
28  */
29 class GDCM_EXPORT gdcmElValSet {
30 public: 
31    ~gdcmElValSet();
32
33    void Print(std::ostream &);
34
35    void Add(gdcmElValue*);
36                         
37    gdcmElValue* GetElementByNumber(guint16 group, guint16 element);
38    std::string  GetElValueByNumber(guint16 group, guint16 element);
39         
40    bool SetElValueByNumber(std::string content, guint16 group, guint16 element);
41    bool SetElValueLengthByNumber(guint32 l, guint16 group, guint16 element);
42    bool SetVoidAreaByNumber(void *a, guint16 Group, guint16 Elem );
43
44    guint32 GenerateFreeTagKeyInGroup(guint16 group);
45    int CheckIfExistByNumber(guint16 Group, guint16 Elem );  // int !
46
47    /**
48     * \ingroup gdcmElValSet
49     * \brief   returns a ref to the Dicom Header H table (multimap)
50     * return the Dicom Header H table
51     */
52    inline TagElValueHT & gdcmElValSet::GetTagHt(void) { return tagHt; };
53
54    /**
55     * \ingroup gdcmElValSet
56     * \brief   returns a ref to the Dicom Header chained list
57     * return the Dicom Header chained list
58     */
59    inline ListTag      & gdcmElValSet::GetListElem(void) { return listElem; };
60
61    bool Write(FILE *fp, FileType type);
62
63 private:
64    void UpdateGroupLength(bool SkipSequence = false, FileType type = ImplicitVR);
65    void WriteElements(FileType type, FILE *);
66    
67 // Variables
68    TagElValueHT tagHt; // H Table (multimap), to provide fast access
69    ListTag listElem;   // chained list, to keep the 'spacial' ordering
70 };
71
72 //-----------------------------------------------------------------------------
73 #endif