1 /*=========================================================================
4 Module: $RCSfile: gdcmSQItem.h,v $
6 Date: $Date: 2005/01/25 11:11:59 $
7 Version: $Revision: 1.36 $
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.
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.
17 =========================================================================*/
21 #include "gdcmDocEntrySet.h"
22 #include "gdcmElementSet.h"
31 //-----------------------------------------------------------------------------
32 typedef std::list<DocEntry *> ListDocEntry;
33 //-----------------------------------------------------------------------------
35 * \brief a SeqEntry is composed by a set of SQItems.
36 * Each SQItem is composed by a set of DocEntry
37 * A DocEntry may be a SeqEntry
40 class GDCM_EXPORT SQItem : public DocEntrySet
43 SQItem(int depthLevel);
46 virtual void Print(std::ostream &os = std::cout, std::string const & indent = "" );
47 void WriteContent(std::ofstream *fp, FileType filetype);
49 /// \brief returns the DocEntry chained List for this SQ Item.
50 ListDocEntry const &GetDocEntries() const { return DocEntries; };
53 bool AddEntry(DocEntry *Entry); // add to the List
54 bool RemoveEntry(DocEntry *EntryToRemove);
55 bool RemoveEntryNoDestroy(DocEntry *EntryToRemove);
57 DocEntry *GetDocEntry(uint16_t group, uint16_t elem);
58 ValEntry *GetValEntry(uint16_t group, uint16_t elem);
59 BinEntry *GetBinEntry(uint16_t group, uint16_t elem);
60 SeqEntry *GetSeqEntry(uint16_t group, uint16_t elem);
62 bool SetEntryValue(std::string const &val, uint16_t group,
65 std::string GetEntryValue(uint16_t group, uint16_t elem);
67 /// \brief returns the ordinal position of a given SQItem
68 int GetSQItemNumber() { return SQItemNumber; };
70 /// \brief Sets the ordinal position of a given SQItem
71 void SetSQItemNumber(int itemNumber) { SQItemNumber = itemNumber; };
73 /// \brief Accessor on \ref SQDepthLevel.
74 int GetDepthLevel() { return SQDepthLevel; }
76 /// \brief Accessor on \ref SQDepthLevel.
77 void SetDepthLevel(int depth) { SQDepthLevel = depth; }
79 /// \brief Accessor on \ref BaseTagKey.
80 void SetBaseTagKey( BaseTagKey const &key ) { BaseTagKeyNested = key; }
82 /// \brief Accessor on \ref BaseTagKey.
83 BaseTagKey const &GetBaseTagKey() const { return BaseTagKeyNested; }
85 DocEntry *GetFirstEntry();
86 DocEntry *GetNextEntry();
89 // Variables that need to be access in subclasses
91 /// \brief Chained list of (Elementary) Doc Entries
92 ListDocEntry DocEntries;
93 /// Chained list iterator, used to visit the TagHT variable
94 ListDocEntry::iterator ItDocEntries;
96 /// \brief pointer to the HTable of the Document,
97 /// (because we don't know it within any DicomDirObject nor any SQItem)
98 // TagDocEntryHT *PtagHT;
102 /// \brief Sequences can be nested. This \ref SQDepthLevel represents
103 /// the level of the nesting of instances of this class.
104 /// \ref SQDepthLevel and its \ref SeqEntry::SQDepthLevel
105 /// counterpart are only defined on printing purposes
106 /// (see \ref Print).
109 /// \brief A TagKey of a DocEntry nested in a sequence is prepended
110 /// with this BaseTagKey.
111 BaseTagKey BaseTagKeyNested;
113 /// \brief SQ Item ordinal number
116 } // end namespace gdcm
117 //-----------------------------------------------------------------------------