1 /*
2  *
3  *  Copyright (C) 2008-2012, OFFIS e.V. and ICSMED AG, Oldenburg, Germany
4  *  Copyright (C) 2013-2017, J. Riesmeier, Oldenburg, Germany
5  *  All rights reserved.  See COPYRIGHT file for details.
6  *
7  *  Header file for class DRTReferencedDoseReferenceSequenceInRTBeamsModule
8  *
9  *  Generated automatically from DICOM PS 3.3-2017e
10  *  File created on 2017-12-05 09:30:54
11  *
12  */
13 
14 
15 #ifndef DRTRDRS1_H
16 #define DRTRDRS1_H
17 
18 #include "dcmtk/config/osconfig.h"     // make sure OS specific configuration is included first
19 
20 #include "dcmtk/ofstd/oflist.h"        // for standard list class
21 #include "dcmtk/dcmrt/drttypes.h"      // module-specific helper class
22 #include "dcmtk/dcmrt/seq/drtbvcps.h"  // for BeamDoseVerificationControlPointSequence
23 
24 
25 /** Interface class for ReferencedDoseReferenceSequence (300c,0050) in RTBeamsModule
26  */
27 class DCMTK_DCMRT_EXPORT DRTReferencedDoseReferenceSequenceInRTBeamsModule
28   : protected DRTTypes
29 {
30 
31   public:
32 
33     /** Item class
34      */
35     class DCMTK_DCMRT_EXPORT Item
36       : protected DRTTypes
37     {
38 
39       public:
40 
41       // --- constructors, destructor and operators ---
42 
43         /** (default) constructor
44          *  @param emptyDefaultItem flag used to mark the empty default item
45          */
46         Item(const OFBool emptyDefaultItem = OFFalse);
47 
48         /** copy constructor
49          *  @param copy item object to be copied
50          */
51         Item(const Item &copy);
52 
53         /** destructor
54          */
55         virtual ~Item();
56 
57         /** assigment operator
58          *  @param copy item object to be copied
59          *  @return reference to this object
60          */
61         Item &operator=(const Item &copy);
62 
63       // --- general methods ---
64 
65         /** clear all internal member variables
66          */
67         void clear();
68 
69         /** check if item is empty
70          *  @return OFTrue if item is empty, OFFalse otherwise
71          */
72         OFBool isEmpty();
73 
74         /** check if item is valid, i.e.\ not the empty default item
75          *  @return OFTrue if item is valid, OFFalse otherwise
76          */
77         OFBool isValid() const;
78 
79       // --- input/output methods ---
80 
81         /** read elements from sequence item
82          *  @param  item    reference to DICOM sequence item from which the elements should be read
83          *  @return status, EC_Normal if successful, an error code otherwise
84          */
85         OFCondition read(DcmItem &item);
86 
87         /** write elements to sequence item
88          *  @param  item    reference to DICOM sequence item to which the elements should be written
89          *  @return status, EC_Normal if successful, an error code otherwise
90          */
91         OFCondition write(DcmItem &item);
92 
93       // --- get DICOM attribute values ---
94 
95         /** get DepthValueAveragingFlag (300a,0093)
96          *  @param  value  reference to variable in which the value should be stored
97          *  @param  pos    index of the value to get (0..vm-1), -1 for all components
98          *  @return status, EC_Normal if successful, an error code otherwise
99          */
100         OFCondition getDepthValueAveragingFlag(OFString &value, const signed long pos = 0) const;
101 
102         /** get ReferencedDoseReferenceNumber (300c,0051)
103          *  @param  value  reference to variable in which the value should be stored
104          *  @param  pos    index of the value to get (0..vm-1), -1 for all components
105          *  @return status, EC_Normal if successful, an error code otherwise
106          */
107         OFCondition getReferencedDoseReferenceNumber(OFString &value, const signed long pos = 0) const;
108 
109         /** get ReferencedDoseReferenceNumber (300c,0051)
110          *  @param  value  reference to variable in which the value should be stored
111          *  @param  pos    index of the value to get (0..vm-1)
112          *  @return status, EC_Normal if successful, an error code otherwise
113          */
114         OFCondition getReferencedDoseReferenceNumber(Sint32 &value, const unsigned long pos = 0) const;
115 
116       // --- get DICOM sequence attributes ---
117 
118         /** get BeamDoseVerificationControlPointSequence (300a,008c)
119          *  @return reference to sequence element
120          */
getBeamDoseVerificationControlPointSequence()121         DRTBeamDoseVerificationControlPointSequence &getBeamDoseVerificationControlPointSequence()
122             { return BeamDoseVerificationControlPointSequence; }
123 
124         /** get BeamDoseVerificationControlPointSequence (300a,008c)
125          *  @return const reference to sequence element
126          */
getBeamDoseVerificationControlPointSequence()127         const DRTBeamDoseVerificationControlPointSequence &getBeamDoseVerificationControlPointSequence() const
128             { return BeamDoseVerificationControlPointSequence; }
129 
130       // --- set DICOM attribute values ---
131 
132         /** set DepthValueAveragingFlag (300a,0093)
133          *  @param  value  value to be set (single value only) or "" for no value
134          *  @param  check  check 'value' for conformance with VR (CS) and VM (1) if enabled
135          *  @return status, EC_Normal if successful, an error code otherwise
136          */
137         OFCondition setDepthValueAveragingFlag(const OFString &value, const OFBool check = OFTrue);
138 
139         /** set ReferencedDoseReferenceNumber (300c,0051)
140          *  @param  value  value to be set (single value only) or "" for no value
141          *  @param  check  check 'value' for conformance with VR (IS) and VM (1) if enabled
142          *  @return status, EC_Normal if successful, an error code otherwise
143          */
144         OFCondition setReferencedDoseReferenceNumber(const OFString &value, const OFBool check = OFTrue);
145 
146       private:
147 
148         /// internal flag used to mark the empty default item
149         /*const*/ OFBool EmptyDefaultItem;
150 
151         /// BeamDoseVerificationControlPointSequence (300a,008c) vr=SQ, vm=1, type=1
152         DRTBeamDoseVerificationControlPointSequence BeamDoseVerificationControlPointSequence;
153         /// DepthValueAveragingFlag (300a,0093) vr=CS, vm=1, type=1C
154         DcmCodeString DepthValueAveragingFlag;
155         /// ReferencedDoseReferenceNumber (300c,0051) vr=IS, vm=1, type=1
156         DcmIntegerString ReferencedDoseReferenceNumber;
157 
158     };
159 
160   // --- constructors, destructor and operators ---
161 
162     /** (default) constructor
163      *  @param emptyDefaultSequence internal flag used to mark the empty default sequence
164      */
165     DRTReferencedDoseReferenceSequenceInRTBeamsModule(const OFBool emptyDefaultSequence = OFFalse);
166 
167     /** copy constructor
168      *  @param copy sequence object to be copied
169      */
170     DRTReferencedDoseReferenceSequenceInRTBeamsModule(const DRTReferencedDoseReferenceSequenceInRTBeamsModule &copy);
171 
172     /** destructor
173      */
174     virtual ~DRTReferencedDoseReferenceSequenceInRTBeamsModule();
175 
176     /** assigment operator
177      *  @param copy sequence object to be copied
178      *  @return reference to this object
179      */
180     DRTReferencedDoseReferenceSequenceInRTBeamsModule &operator=(const DRTReferencedDoseReferenceSequenceInRTBeamsModule &copy);
181 
182   // --- general methods ---
183 
184     /** clear all internal member variables
185      */
186     void clear();
187 
188     /** check if sequence is empty
189      *  @return OFTrue if sequence is empty, OFFalse otherwise
190      */
191     OFBool isEmpty();
192 
193     /** check if sequence is valid, i.e.\ not the empty default sequence
194      *  @return OFTrue if sequence is valid, OFFalse otherwise
195      */
196     OFBool isValid() const;
197 
198     /** get number of items in the sequence
199      *  @return number of items
200      */
201     size_t getNumberOfItems() const;
202 
203     /** goto first item in the sequence
204      *  @return status, EC_Normal if successful, an error code otherwise
205      */
206     OFCondition gotoFirstItem();
207 
208     /** goto next item in the sequence
209      *  @return status, EC_Normal if successful, an error code otherwise
210      */
211     OFCondition gotoNextItem();
212 
213     /** goto particular item in the sequence
214      *  @param  num  number of the item to be selected (0..num-1)
215      *  @return status, EC_Normal if successful, an error code otherwise
216      */
217     OFCondition gotoItem(const size_t num);
218 
219     /** get current item in the sequence
220      *  @param  item  reference to item pointer (result variable)
221      *  @return status, EC_Normal if successful, an error code otherwise
222      */
223     OFCondition getCurrentItem(Item *&item) const;
224 
225     /** get current item in the sequence
226      *  @return reference to specified item if successful, empty default item otherwise
227      */
228     Item &getCurrentItem();
229 
230     /** get current item in the sequence
231      *  @return const reference to specified item if successful, empty default item otherwise
232      */
233     const Item &getCurrentItem() const;
234 
235     /** get particular item in the sequence
236      *  @param  num   number of the item to be retrieved (0..num-1)
237      *  @param  item  reference to item pointer (result variable)
238      *  @return status, EC_Normal if successful, an error code otherwise
239      */
240     OFCondition getItem(const size_t num, Item *&item);
241 
242     /** get particular item in the sequence
243      *  @param  num  number of the item to be retrieved (0..num-1)
244      *  @return reference to specified item if successful, empty default item otherwise
245      */
246     Item &getItem(const size_t num);
247 
248     /** get particular item in the sequence
249      *  @param  num  number of the item to be retrieved (0..num-1)
250      *  @return const reference to specified item if successful, empty default item otherwise
251      */
252     const Item &getItem(const size_t num) const;
253 
254     /** get particular item in the sequence
255      *  @param  num  number of the item to be retrieved (0..num-1)
256      *  @return reference to specified item if successful, empty default item otherwise
257      */
258     Item &operator[](const size_t num);
259 
260     /** get particular item in the sequence
261      *  @param  num  number of the item to be retrieved (0..num-1)
262      *  @return const reference to specified item if successful, empty default item otherwise
263      */
264     const Item &operator[](const size_t num) const;
265 
266     /** add new item to the end of this sequence
267      *  @param  item  reference to new item pointer (result variable)
268      *  @return status, EC_Normal if successful, an error code otherwise
269      */
270     OFCondition addItem(Item *&item);
271 
272     /** insert new item into the sequence
273      *  @param  pos   position where the new item is to be inserted (0..num)
274      *  @param  item  reference to new item pointer (result variable)
275      *  @return status, EC_Normal if successful, an error code otherwise
276      */
277     OFCondition insertItem(const size_t pos, Item *&item);
278 
279     /** remove particular item from the sequence
280      *  @param  pos  position of the item to be removed (0..num-1)
281      *  @return status, EC_Normal if successful, an error code otherwise
282      */
283     OFCondition removeItem(const size_t pos);
284 
285   // --- input/output methods ---
286 
287     /** read sequence of items from dataset
288      *  @param  dataset     reference to DICOM dataset from which the sequence should be read
289      *  @param  card        cardinality (valid range for number of items)
290      *  @param  type        value type (valid value: "1", "1C", "2" or something else which is not checked)
291      *  @param  moduleName  optional module/sequence name to be printed (default: "RT object" if NULL)
292      *  @return status, EC_Normal if successful, an error code otherwise
293      */
294     OFCondition read(DcmItem &dataset,
295                      const OFString &card,
296                      const OFString &type,
297                      const char *moduleName = NULL);
298 
299     /** write sequence of items to dataset
300      *  @param  dataset     reference to DICOM dataset to which the sequence should be written
301      *  @param  card        cardinality (valid range for number of items)
302      *  @param  type        value type (valid value: "1", "2" or something else which is not checked)
303      *  @param  moduleName  optional module/sequence name to be printed (default: "RT object" if NULL)
304      *  @return status, EC_Normal if successful, an error code otherwise
305      */
306     OFCondition write(DcmItem &dataset,
307                       const OFString &card,
308                       const OFString &type,
309                       const char *moduleName = NULL);
310 
311   protected:
312 
313     /** goto particular item in the sequence
314      *  @param  num       number of the item to be selected (0..num-1)
315      *  @param  iterator  list iterator storing the position of the item
316      *  @return status, EC_Normal if successful, an error code otherwise
317      */
318     OFCondition gotoItem(const size_t num,
319                          OFListIterator(Item *) &iterator);
320 
321     /** goto particular item in the sequence
322      *  @param  num       number of the item to be selected (0..num-1)
323      *  @param  iterator  list iterator storing the position of the item
324      *  @return status, EC_Normal if successful, an error code otherwise
325      */
326     OFCondition gotoItem(const size_t num,
327                          OFListConstIterator(Item *) &iterator) const;
328 
329   private:
330 
331     /// internal flag used to mark the empty default sequence
332     /*const*/ OFBool EmptyDefaultSequence;
333 
334     /// list of items in this sequence
335     OFList<Item *>         SequenceOfItems;
336     /// currently selected item
337     OFListIterator(Item *) CurrentItem;
338     /// empty default item
339     Item                   EmptyItem;
340 
341 };
342 
343 
344 #endif
345