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  *  Source file for class DRTIonControlPointDeliverySequence
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 #include "dcmtk/config/osconfig.h"     // make sure OS specific configuration is included first
16 
17 #include "dcmtk/dcmrt/seq/drticpds.h"
18 
19 
20 // --- item class ---
21 
Item(const OFBool emptyDefaultItem)22 DRTIonControlPointDeliverySequence::Item::Item(const OFBool emptyDefaultItem)
23   : EmptyDefaultItem(emptyDefaultItem),
24     BeamLimitingDeviceAngle(DCM_BeamLimitingDeviceAngle),
25     BeamLimitingDevicePositionSequence(emptyDefaultItem /*emptyDefaultSequence*/),
26     BeamLimitingDeviceRotationDirection(DCM_BeamLimitingDeviceRotationDirection),
27     ChairHeadFramePosition(DCM_ChairHeadFramePosition),
28     CorrectedParameterSequence(emptyDefaultItem /*emptyDefaultSequence*/),
29     DeliveredMeterset(DCM_DeliveredMeterset),
30     GantryAngle(DCM_GantryAngle),
31     GantryPitchAngle(DCM_GantryPitchAngle),
32     GantryPitchRotationDirection(DCM_GantryPitchRotationDirection),
33     GantryRotationDirection(DCM_GantryRotationDirection),
34     HeadFixationAngle(DCM_HeadFixationAngle),
35     IonWedgePositionSequence(emptyDefaultItem /*emptyDefaultSequence*/),
36     KVP(DCM_KVP),
37     LateralSpreadingDeviceSettingsSequence(emptyDefaultItem /*emptyDefaultSequence*/),
38     MetersetRateDelivered(DCM_MetersetRateDelivered),
39     MetersetRateSet(DCM_MetersetRateSet),
40     NominalBeamEnergy(DCM_NominalBeamEnergy),
41     NumberOfPaintings(DCM_NumberOfPaintings),
42     NumberOfScanSpotPositions(DCM_NumberOfScanSpotPositions),
43     OverrideSequence(emptyDefaultItem /*emptyDefaultSequence*/),
44     PatientSupportAngle(DCM_PatientSupportAngle),
45     PatientSupportRotationDirection(DCM_PatientSupportRotationDirection),
46     RangeModulatorSettingsSequence(emptyDefaultItem /*emptyDefaultSequence*/),
47     RangeShifterSettingsSequence(emptyDefaultItem /*emptyDefaultSequence*/),
48     ReferencedControlPointIndex(DCM_ReferencedControlPointIndex),
49     ScanSpotMetersetsDelivered(DCM_ScanSpotMetersetsDelivered),
50     ScanSpotPositionMap(DCM_ScanSpotPositionMap),
51     ScanSpotPrescribedIndices(DCM_ScanSpotPrescribedIndices),
52     ScanSpotReordered(DCM_ScanSpotReordered),
53     ScanSpotTimeOffset(DCM_ScanSpotTimeOffset),
54     ScanSpotTuneID(DCM_ScanSpotTuneID),
55     ScanningSpotSize(DCM_ScanningSpotSize),
56     SnoutPosition(DCM_SnoutPosition),
57     SpecifiedMeterset(DCM_SpecifiedMeterset),
58     TableTopLateralPosition(DCM_TableTopLateralPosition),
59     TableTopLongitudinalPosition(DCM_TableTopLongitudinalPosition),
60     TableTopPitchAngle(DCM_TableTopPitchAngle),
61     TableTopPitchRotationDirection(DCM_TableTopPitchRotationDirection),
62     TableTopRollAngle(DCM_TableTopRollAngle),
63     TableTopRollRotationDirection(DCM_TableTopRollRotationDirection),
64     TableTopVerticalPosition(DCM_TableTopVerticalPosition),
65     TreatmentControlPointDate(DCM_TreatmentControlPointDate),
66     TreatmentControlPointTime(DCM_TreatmentControlPointTime)
67 {
68 }
69 
70 
Item(const Item & copy)71 DRTIonControlPointDeliverySequence::Item::Item(const Item &copy)
72   : EmptyDefaultItem(copy.EmptyDefaultItem),
73     BeamLimitingDeviceAngle(copy.BeamLimitingDeviceAngle),
74     BeamLimitingDevicePositionSequence(copy.BeamLimitingDevicePositionSequence),
75     BeamLimitingDeviceRotationDirection(copy.BeamLimitingDeviceRotationDirection),
76     ChairHeadFramePosition(copy.ChairHeadFramePosition),
77     CorrectedParameterSequence(copy.CorrectedParameterSequence),
78     DeliveredMeterset(copy.DeliveredMeterset),
79     GantryAngle(copy.GantryAngle),
80     GantryPitchAngle(copy.GantryPitchAngle),
81     GantryPitchRotationDirection(copy.GantryPitchRotationDirection),
82     GantryRotationDirection(copy.GantryRotationDirection),
83     HeadFixationAngle(copy.HeadFixationAngle),
84     IonWedgePositionSequence(copy.IonWedgePositionSequence),
85     KVP(copy.KVP),
86     LateralSpreadingDeviceSettingsSequence(copy.LateralSpreadingDeviceSettingsSequence),
87     MetersetRateDelivered(copy.MetersetRateDelivered),
88     MetersetRateSet(copy.MetersetRateSet),
89     NominalBeamEnergy(copy.NominalBeamEnergy),
90     NumberOfPaintings(copy.NumberOfPaintings),
91     NumberOfScanSpotPositions(copy.NumberOfScanSpotPositions),
92     OverrideSequence(copy.OverrideSequence),
93     PatientSupportAngle(copy.PatientSupportAngle),
94     PatientSupportRotationDirection(copy.PatientSupportRotationDirection),
95     RangeModulatorSettingsSequence(copy.RangeModulatorSettingsSequence),
96     RangeShifterSettingsSequence(copy.RangeShifterSettingsSequence),
97     ReferencedControlPointIndex(copy.ReferencedControlPointIndex),
98     ScanSpotMetersetsDelivered(copy.ScanSpotMetersetsDelivered),
99     ScanSpotPositionMap(copy.ScanSpotPositionMap),
100     ScanSpotPrescribedIndices(copy.ScanSpotPrescribedIndices),
101     ScanSpotReordered(copy.ScanSpotReordered),
102     ScanSpotTimeOffset(copy.ScanSpotTimeOffset),
103     ScanSpotTuneID(copy.ScanSpotTuneID),
104     ScanningSpotSize(copy.ScanningSpotSize),
105     SnoutPosition(copy.SnoutPosition),
106     SpecifiedMeterset(copy.SpecifiedMeterset),
107     TableTopLateralPosition(copy.TableTopLateralPosition),
108     TableTopLongitudinalPosition(copy.TableTopLongitudinalPosition),
109     TableTopPitchAngle(copy.TableTopPitchAngle),
110     TableTopPitchRotationDirection(copy.TableTopPitchRotationDirection),
111     TableTopRollAngle(copy.TableTopRollAngle),
112     TableTopRollRotationDirection(copy.TableTopRollRotationDirection),
113     TableTopVerticalPosition(copy.TableTopVerticalPosition),
114     TreatmentControlPointDate(copy.TreatmentControlPointDate),
115     TreatmentControlPointTime(copy.TreatmentControlPointTime)
116 {
117 }
118 
119 
~Item()120 DRTIonControlPointDeliverySequence::Item::~Item()
121 {
122 }
123 
124 
operator =(const Item & copy)125 DRTIonControlPointDeliverySequence::Item &DRTIonControlPointDeliverySequence::Item::operator=(const Item &copy)
126 {
127     if (this != &copy)
128     {
129         EmptyDefaultItem = copy.EmptyDefaultItem;
130         BeamLimitingDeviceAngle = copy.BeamLimitingDeviceAngle;
131         BeamLimitingDevicePositionSequence = copy.BeamLimitingDevicePositionSequence;
132         BeamLimitingDeviceRotationDirection = copy.BeamLimitingDeviceRotationDirection;
133         ChairHeadFramePosition = copy.ChairHeadFramePosition;
134         CorrectedParameterSequence = copy.CorrectedParameterSequence;
135         DeliveredMeterset = copy.DeliveredMeterset;
136         GantryAngle = copy.GantryAngle;
137         GantryPitchAngle = copy.GantryPitchAngle;
138         GantryPitchRotationDirection = copy.GantryPitchRotationDirection;
139         GantryRotationDirection = copy.GantryRotationDirection;
140         HeadFixationAngle = copy.HeadFixationAngle;
141         IonWedgePositionSequence = copy.IonWedgePositionSequence;
142         KVP = copy.KVP;
143         LateralSpreadingDeviceSettingsSequence = copy.LateralSpreadingDeviceSettingsSequence;
144         MetersetRateDelivered = copy.MetersetRateDelivered;
145         MetersetRateSet = copy.MetersetRateSet;
146         NominalBeamEnergy = copy.NominalBeamEnergy;
147         NumberOfPaintings = copy.NumberOfPaintings;
148         NumberOfScanSpotPositions = copy.NumberOfScanSpotPositions;
149         OverrideSequence = copy.OverrideSequence;
150         PatientSupportAngle = copy.PatientSupportAngle;
151         PatientSupportRotationDirection = copy.PatientSupportRotationDirection;
152         RangeModulatorSettingsSequence = copy.RangeModulatorSettingsSequence;
153         RangeShifterSettingsSequence = copy.RangeShifterSettingsSequence;
154         ReferencedControlPointIndex = copy.ReferencedControlPointIndex;
155         ScanSpotMetersetsDelivered = copy.ScanSpotMetersetsDelivered;
156         ScanSpotPositionMap = copy.ScanSpotPositionMap;
157         ScanSpotPrescribedIndices = copy.ScanSpotPrescribedIndices;
158         ScanSpotReordered = copy.ScanSpotReordered;
159         ScanSpotTimeOffset = copy.ScanSpotTimeOffset;
160         ScanSpotTuneID = copy.ScanSpotTuneID;
161         ScanningSpotSize = copy.ScanningSpotSize;
162         SnoutPosition = copy.SnoutPosition;
163         SpecifiedMeterset = copy.SpecifiedMeterset;
164         TableTopLateralPosition = copy.TableTopLateralPosition;
165         TableTopLongitudinalPosition = copy.TableTopLongitudinalPosition;
166         TableTopPitchAngle = copy.TableTopPitchAngle;
167         TableTopPitchRotationDirection = copy.TableTopPitchRotationDirection;
168         TableTopRollAngle = copy.TableTopRollAngle;
169         TableTopRollRotationDirection = copy.TableTopRollRotationDirection;
170         TableTopVerticalPosition = copy.TableTopVerticalPosition;
171         TreatmentControlPointDate = copy.TreatmentControlPointDate;
172         TreatmentControlPointTime = copy.TreatmentControlPointTime;
173     }
174     return *this;
175 }
176 
177 
clear()178 void DRTIonControlPointDeliverySequence::Item::clear()
179 {
180     if (!EmptyDefaultItem)
181     {
182         /* clear all DICOM attributes */
183         ReferencedControlPointIndex.clear();
184         TreatmentControlPointDate.clear();
185         TreatmentControlPointTime.clear();
186         SpecifiedMeterset.clear();
187         DeliveredMeterset.clear();
188         MetersetRateSet.clear();
189         MetersetRateDelivered.clear();
190         NominalBeamEnergy.clear();
191         KVP.clear();
192         IonWedgePositionSequence.clear();
193         BeamLimitingDevicePositionSequence.clear();
194         RangeShifterSettingsSequence.clear();
195         LateralSpreadingDeviceSettingsSequence.clear();
196         RangeModulatorSettingsSequence.clear();
197         GantryAngle.clear();
198         GantryRotationDirection.clear();
199         GantryPitchAngle.clear();
200         GantryPitchRotationDirection.clear();
201         BeamLimitingDeviceAngle.clear();
202         BeamLimitingDeviceRotationDirection.clear();
203         ScanSpotTuneID.clear();
204         NumberOfScanSpotPositions.clear();
205         ScanSpotPositionMap.clear();
206         ScanSpotMetersetsDelivered.clear();
207         ScanSpotTimeOffset.clear();
208         ScanningSpotSize.clear();
209         NumberOfPaintings.clear();
210         ScanSpotReordered.clear();
211         ScanSpotPrescribedIndices.clear();
212         PatientSupportAngle.clear();
213         PatientSupportRotationDirection.clear();
214         TableTopPitchAngle.clear();
215         TableTopPitchRotationDirection.clear();
216         TableTopRollAngle.clear();
217         TableTopRollRotationDirection.clear();
218         HeadFixationAngle.clear();
219         ChairHeadFramePosition.clear();
220         TableTopVerticalPosition.clear();
221         TableTopLongitudinalPosition.clear();
222         TableTopLateralPosition.clear();
223         SnoutPosition.clear();
224         CorrectedParameterSequence.clear();
225         OverrideSequence.clear();
226     }
227 }
228 
229 
isEmpty()230 OFBool DRTIonControlPointDeliverySequence::Item::isEmpty()
231 {
232     return ReferencedControlPointIndex.isEmpty() &&
233            TreatmentControlPointDate.isEmpty() &&
234            TreatmentControlPointTime.isEmpty() &&
235            SpecifiedMeterset.isEmpty() &&
236            DeliveredMeterset.isEmpty() &&
237            MetersetRateSet.isEmpty() &&
238            MetersetRateDelivered.isEmpty() &&
239            NominalBeamEnergy.isEmpty() &&
240            KVP.isEmpty() &&
241            IonWedgePositionSequence.isEmpty() &&
242            BeamLimitingDevicePositionSequence.isEmpty() &&
243            RangeShifterSettingsSequence.isEmpty() &&
244            LateralSpreadingDeviceSettingsSequence.isEmpty() &&
245            RangeModulatorSettingsSequence.isEmpty() &&
246            GantryAngle.isEmpty() &&
247            GantryRotationDirection.isEmpty() &&
248            GantryPitchAngle.isEmpty() &&
249            GantryPitchRotationDirection.isEmpty() &&
250            BeamLimitingDeviceAngle.isEmpty() &&
251            BeamLimitingDeviceRotationDirection.isEmpty() &&
252            ScanSpotTuneID.isEmpty() &&
253            NumberOfScanSpotPositions.isEmpty() &&
254            ScanSpotPositionMap.isEmpty() &&
255            ScanSpotMetersetsDelivered.isEmpty() &&
256            ScanSpotTimeOffset.isEmpty() &&
257            ScanningSpotSize.isEmpty() &&
258            NumberOfPaintings.isEmpty() &&
259            ScanSpotReordered.isEmpty() &&
260            ScanSpotPrescribedIndices.isEmpty() &&
261            PatientSupportAngle.isEmpty() &&
262            PatientSupportRotationDirection.isEmpty() &&
263            TableTopPitchAngle.isEmpty() &&
264            TableTopPitchRotationDirection.isEmpty() &&
265            TableTopRollAngle.isEmpty() &&
266            TableTopRollRotationDirection.isEmpty() &&
267            HeadFixationAngle.isEmpty() &&
268            ChairHeadFramePosition.isEmpty() &&
269            TableTopVerticalPosition.isEmpty() &&
270            TableTopLongitudinalPosition.isEmpty() &&
271            TableTopLateralPosition.isEmpty() &&
272            SnoutPosition.isEmpty() &&
273            CorrectedParameterSequence.isEmpty() &&
274            OverrideSequence.isEmpty();
275 }
276 
277 
isValid() const278 OFBool DRTIonControlPointDeliverySequence::Item::isValid() const
279 {
280     return !EmptyDefaultItem;
281 }
282 
283 
read(DcmItem & item)284 OFCondition DRTIonControlPointDeliverySequence::Item::read(DcmItem &item)
285 {
286     OFCondition result = EC_IllegalCall;
287     if (!EmptyDefaultItem)
288     {
289         /* re-initialize object */
290         clear();
291         getAndCheckElementFromDataset(item, ReferencedControlPointIndex, "1", "1", "IonControlPointDeliverySequence");
292         getAndCheckElementFromDataset(item, TreatmentControlPointDate, "1", "1", "IonControlPointDeliverySequence");
293         getAndCheckElementFromDataset(item, TreatmentControlPointTime, "1", "1", "IonControlPointDeliverySequence");
294         getAndCheckElementFromDataset(item, SpecifiedMeterset, "1", "2", "IonControlPointDeliverySequence");
295         getAndCheckElementFromDataset(item, DeliveredMeterset, "1", "1", "IonControlPointDeliverySequence");
296         getAndCheckElementFromDataset(item, MetersetRateSet, "1", "3", "IonControlPointDeliverySequence");
297         getAndCheckElementFromDataset(item, MetersetRateDelivered, "1", "3", "IonControlPointDeliverySequence");
298         getAndCheckElementFromDataset(item, NominalBeamEnergy, "1", "1C", "IonControlPointDeliverySequence");
299         getAndCheckElementFromDataset(item, KVP, "1", "1C", "IonControlPointDeliverySequence");
300         IonWedgePositionSequence.read(item, "1-n", "1C", "IonControlPointDeliverySequence");
301         BeamLimitingDevicePositionSequence.read(item, "1-n", "1C", "IonControlPointDeliverySequence");
302         RangeShifterSettingsSequence.read(item, "1-n", "1C", "IonControlPointDeliverySequence");
303         LateralSpreadingDeviceSettingsSequence.read(item, "1-n", "1C", "IonControlPointDeliverySequence");
304         RangeModulatorSettingsSequence.read(item, "1-n", "1C", "IonControlPointDeliverySequence");
305         getAndCheckElementFromDataset(item, GantryAngle, "1", "1C", "IonControlPointDeliverySequence");
306         getAndCheckElementFromDataset(item, GantryRotationDirection, "1", "1C", "IonControlPointDeliverySequence");
307         getAndCheckElementFromDataset(item, GantryPitchAngle, "1", "2C", "IonControlPointDeliverySequence");
308         getAndCheckElementFromDataset(item, GantryPitchRotationDirection, "1", "2C", "IonControlPointDeliverySequence");
309         getAndCheckElementFromDataset(item, BeamLimitingDeviceAngle, "1", "1C", "IonControlPointDeliverySequence");
310         getAndCheckElementFromDataset(item, BeamLimitingDeviceRotationDirection, "1", "1C", "IonControlPointDeliverySequence");
311         getAndCheckElementFromDataset(item, ScanSpotTuneID, "1", "1C", "IonControlPointDeliverySequence");
312         getAndCheckElementFromDataset(item, NumberOfScanSpotPositions, "1", "1C", "IonControlPointDeliverySequence");
313         getAndCheckElementFromDataset(item, ScanSpotPositionMap, "1-n", "1C", "IonControlPointDeliverySequence");
314         getAndCheckElementFromDataset(item, ScanSpotMetersetsDelivered, "1-n", "1C", "IonControlPointDeliverySequence");
315         getAndCheckElementFromDataset(item, ScanSpotTimeOffset, "1-n", "3", "IonControlPointDeliverySequence");
316         getAndCheckElementFromDataset(item, ScanningSpotSize, "2", "3", "IonControlPointDeliverySequence");
317         getAndCheckElementFromDataset(item, NumberOfPaintings, "1", "1C", "IonControlPointDeliverySequence");
318         getAndCheckElementFromDataset(item, ScanSpotReordered, "1", "3", "IonControlPointDeliverySequence");
319         getAndCheckElementFromDataset(item, ScanSpotPrescribedIndices, "1-n", "1C", "IonControlPointDeliverySequence");
320         getAndCheckElementFromDataset(item, PatientSupportAngle, "1", "1C", "IonControlPointDeliverySequence");
321         getAndCheckElementFromDataset(item, PatientSupportRotationDirection, "1", "1C", "IonControlPointDeliverySequence");
322         getAndCheckElementFromDataset(item, TableTopPitchAngle, "1", "2C", "IonControlPointDeliverySequence");
323         getAndCheckElementFromDataset(item, TableTopPitchRotationDirection, "1", "2C", "IonControlPointDeliverySequence");
324         getAndCheckElementFromDataset(item, TableTopRollAngle, "1", "2C", "IonControlPointDeliverySequence");
325         getAndCheckElementFromDataset(item, TableTopRollRotationDirection, "1", "2C", "IonControlPointDeliverySequence");
326         getAndCheckElementFromDataset(item, HeadFixationAngle, "1", "3", "IonControlPointDeliverySequence");
327         getAndCheckElementFromDataset(item, ChairHeadFramePosition, "1", "3", "IonControlPointDeliverySequence");
328         getAndCheckElementFromDataset(item, TableTopVerticalPosition, "1", "2C", "IonControlPointDeliverySequence");
329         getAndCheckElementFromDataset(item, TableTopLongitudinalPosition, "1", "2C", "IonControlPointDeliverySequence");
330         getAndCheckElementFromDataset(item, TableTopLateralPosition, "1", "2C", "IonControlPointDeliverySequence");
331         getAndCheckElementFromDataset(item, SnoutPosition, "1", "2C", "IonControlPointDeliverySequence");
332         CorrectedParameterSequence.read(item, "1-n", "3", "IonControlPointDeliverySequence");
333         OverrideSequence.read(item, "1-n", "3", "IonControlPointDeliverySequence");
334         result = EC_Normal;
335     }
336     return result;
337 }
338 
339 
write(DcmItem & item)340 OFCondition DRTIonControlPointDeliverySequence::Item::write(DcmItem &item)
341 {
342     OFCondition result = EC_IllegalCall;
343     if (!EmptyDefaultItem)
344     {
345         result = EC_Normal;
346         addElementToDataset(result, item, new DcmIntegerString(ReferencedControlPointIndex), "1", "1", "IonControlPointDeliverySequence");
347         addElementToDataset(result, item, new DcmDate(TreatmentControlPointDate), "1", "1", "IonControlPointDeliverySequence");
348         addElementToDataset(result, item, new DcmTime(TreatmentControlPointTime), "1", "1", "IonControlPointDeliverySequence");
349         addElementToDataset(result, item, new DcmDecimalString(SpecifiedMeterset), "1", "2", "IonControlPointDeliverySequence");
350         addElementToDataset(result, item, new DcmDecimalString(DeliveredMeterset), "1", "1", "IonControlPointDeliverySequence");
351         addElementToDataset(result, item, new DcmFloatingPointSingle(MetersetRateSet), "1", "3", "IonControlPointDeliverySequence");
352         addElementToDataset(result, item, new DcmFloatingPointSingle(MetersetRateDelivered), "1", "3", "IonControlPointDeliverySequence");
353         addElementToDataset(result, item, new DcmDecimalString(NominalBeamEnergy), "1", "1C", "IonControlPointDeliverySequence");
354         addElementToDataset(result, item, new DcmDecimalString(KVP), "1", "1C", "IonControlPointDeliverySequence");
355         if (result.good()) result = IonWedgePositionSequence.write(item, "1-n", "1C", "IonControlPointDeliverySequence");
356         if (result.good()) result = BeamLimitingDevicePositionSequence.write(item, "1-n", "1C", "IonControlPointDeliverySequence");
357         if (result.good()) result = RangeShifterSettingsSequence.write(item, "1-n", "1C", "IonControlPointDeliverySequence");
358         if (result.good()) result = LateralSpreadingDeviceSettingsSequence.write(item, "1-n", "1C", "IonControlPointDeliverySequence");
359         if (result.good()) result = RangeModulatorSettingsSequence.write(item, "1-n", "1C", "IonControlPointDeliverySequence");
360         addElementToDataset(result, item, new DcmDecimalString(GantryAngle), "1", "1C", "IonControlPointDeliverySequence");
361         addElementToDataset(result, item, new DcmCodeString(GantryRotationDirection), "1", "1C", "IonControlPointDeliverySequence");
362         addElementToDataset(result, item, new DcmFloatingPointSingle(GantryPitchAngle), "1", "2C", "IonControlPointDeliverySequence");
363         addElementToDataset(result, item, new DcmCodeString(GantryPitchRotationDirection), "1", "2C", "IonControlPointDeliverySequence");
364         addElementToDataset(result, item, new DcmDecimalString(BeamLimitingDeviceAngle), "1", "1C", "IonControlPointDeliverySequence");
365         addElementToDataset(result, item, new DcmCodeString(BeamLimitingDeviceRotationDirection), "1", "1C", "IonControlPointDeliverySequence");
366         addElementToDataset(result, item, new DcmShortString(ScanSpotTuneID), "1", "1C", "IonControlPointDeliverySequence");
367         addElementToDataset(result, item, new DcmIntegerString(NumberOfScanSpotPositions), "1", "1C", "IonControlPointDeliverySequence");
368         addElementToDataset(result, item, new DcmFloatingPointSingle(ScanSpotPositionMap), "1-n", "1C", "IonControlPointDeliverySequence");
369         addElementToDataset(result, item, new DcmFloatingPointSingle(ScanSpotMetersetsDelivered), "1-n", "1C", "IonControlPointDeliverySequence");
370         addElementToDataset(result, item, new DcmFloatingPointSingle(ScanSpotTimeOffset), "1-n", "3", "IonControlPointDeliverySequence");
371         addElementToDataset(result, item, new DcmFloatingPointSingle(ScanningSpotSize), "2", "3", "IonControlPointDeliverySequence");
372         addElementToDataset(result, item, new DcmIntegerString(NumberOfPaintings), "1", "1C", "IonControlPointDeliverySequence");
373         addElementToDataset(result, item, new DcmCodeString(ScanSpotReordered), "1", "3", "IonControlPointDeliverySequence");
374         addElementToDataset(result, item, new DcmIntegerString(ScanSpotPrescribedIndices), "1-n", "1C", "IonControlPointDeliverySequence");
375         addElementToDataset(result, item, new DcmDecimalString(PatientSupportAngle), "1", "1C", "IonControlPointDeliverySequence");
376         addElementToDataset(result, item, new DcmCodeString(PatientSupportRotationDirection), "1", "1C", "IonControlPointDeliverySequence");
377         addElementToDataset(result, item, new DcmFloatingPointSingle(TableTopPitchAngle), "1", "2C", "IonControlPointDeliverySequence");
378         addElementToDataset(result, item, new DcmCodeString(TableTopPitchRotationDirection), "1", "2C", "IonControlPointDeliverySequence");
379         addElementToDataset(result, item, new DcmFloatingPointSingle(TableTopRollAngle), "1", "2C", "IonControlPointDeliverySequence");
380         addElementToDataset(result, item, new DcmCodeString(TableTopRollRotationDirection), "1", "2C", "IonControlPointDeliverySequence");
381         addElementToDataset(result, item, new DcmFloatingPointSingle(HeadFixationAngle), "1", "3", "IonControlPointDeliverySequence");
382         addElementToDataset(result, item, new DcmDecimalString(ChairHeadFramePosition), "1", "3", "IonControlPointDeliverySequence");
383         addElementToDataset(result, item, new DcmDecimalString(TableTopVerticalPosition), "1", "2C", "IonControlPointDeliverySequence");
384         addElementToDataset(result, item, new DcmDecimalString(TableTopLongitudinalPosition), "1", "2C", "IonControlPointDeliverySequence");
385         addElementToDataset(result, item, new DcmDecimalString(TableTopLateralPosition), "1", "2C", "IonControlPointDeliverySequence");
386         addElementToDataset(result, item, new DcmFloatingPointSingle(SnoutPosition), "1", "2C", "IonControlPointDeliverySequence");
387         if (result.good()) result = CorrectedParameterSequence.write(item, "1-n", "3", "IonControlPointDeliverySequence");
388         if (result.good()) result = OverrideSequence.write(item, "1-n", "3", "IonControlPointDeliverySequence");
389     }
390     return result;
391 }
392 
393 
getBeamLimitingDeviceAngle(OFString & value,const signed long pos) const394 OFCondition DRTIonControlPointDeliverySequence::Item::getBeamLimitingDeviceAngle(OFString &value, const signed long pos) const
395 {
396     if (EmptyDefaultItem)
397         return EC_IllegalCall;
398     else
399         return getStringValueFromElement(BeamLimitingDeviceAngle, value, pos);
400 }
401 
402 
getBeamLimitingDeviceAngle(Float64 & value,const unsigned long pos) const403 OFCondition DRTIonControlPointDeliverySequence::Item::getBeamLimitingDeviceAngle(Float64 &value, const unsigned long pos) const
404 {
405     if (EmptyDefaultItem)
406         return EC_IllegalCall;
407     else
408         return OFconst_cast(DcmDecimalString &, BeamLimitingDeviceAngle).getFloat64(value, pos);
409 }
410 
411 
getBeamLimitingDeviceRotationDirection(OFString & value,const signed long pos) const412 OFCondition DRTIonControlPointDeliverySequence::Item::getBeamLimitingDeviceRotationDirection(OFString &value, const signed long pos) const
413 {
414     if (EmptyDefaultItem)
415         return EC_IllegalCall;
416     else
417         return getStringValueFromElement(BeamLimitingDeviceRotationDirection, value, pos);
418 }
419 
420 
getChairHeadFramePosition(OFString & value,const signed long pos) const421 OFCondition DRTIonControlPointDeliverySequence::Item::getChairHeadFramePosition(OFString &value, const signed long pos) const
422 {
423     if (EmptyDefaultItem)
424         return EC_IllegalCall;
425     else
426         return getStringValueFromElement(ChairHeadFramePosition, value, pos);
427 }
428 
429 
getChairHeadFramePosition(Float64 & value,const unsigned long pos) const430 OFCondition DRTIonControlPointDeliverySequence::Item::getChairHeadFramePosition(Float64 &value, const unsigned long pos) const
431 {
432     if (EmptyDefaultItem)
433         return EC_IllegalCall;
434     else
435         return OFconst_cast(DcmDecimalString &, ChairHeadFramePosition).getFloat64(value, pos);
436 }
437 
438 
getDeliveredMeterset(OFString & value,const signed long pos) const439 OFCondition DRTIonControlPointDeliverySequence::Item::getDeliveredMeterset(OFString &value, const signed long pos) const
440 {
441     if (EmptyDefaultItem)
442         return EC_IllegalCall;
443     else
444         return getStringValueFromElement(DeliveredMeterset, value, pos);
445 }
446 
447 
getDeliveredMeterset(Float64 & value,const unsigned long pos) const448 OFCondition DRTIonControlPointDeliverySequence::Item::getDeliveredMeterset(Float64 &value, const unsigned long pos) const
449 {
450     if (EmptyDefaultItem)
451         return EC_IllegalCall;
452     else
453         return OFconst_cast(DcmDecimalString &, DeliveredMeterset).getFloat64(value, pos);
454 }
455 
456 
getGantryAngle(OFString & value,const signed long pos) const457 OFCondition DRTIonControlPointDeliverySequence::Item::getGantryAngle(OFString &value, const signed long pos) const
458 {
459     if (EmptyDefaultItem)
460         return EC_IllegalCall;
461     else
462         return getStringValueFromElement(GantryAngle, value, pos);
463 }
464 
465 
getGantryAngle(Float64 & value,const unsigned long pos) const466 OFCondition DRTIonControlPointDeliverySequence::Item::getGantryAngle(Float64 &value, const unsigned long pos) const
467 {
468     if (EmptyDefaultItem)
469         return EC_IllegalCall;
470     else
471         return OFconst_cast(DcmDecimalString &, GantryAngle).getFloat64(value, pos);
472 }
473 
474 
getGantryPitchAngle(Float32 & value,const unsigned long pos) const475 OFCondition DRTIonControlPointDeliverySequence::Item::getGantryPitchAngle(Float32 &value, const unsigned long pos) const
476 {
477     if (EmptyDefaultItem)
478         return EC_IllegalCall;
479     else
480         return OFconst_cast(DcmFloatingPointSingle &, GantryPitchAngle).getFloat32(value, pos);
481 }
482 
483 
getGantryPitchRotationDirection(OFString & value,const signed long pos) const484 OFCondition DRTIonControlPointDeliverySequence::Item::getGantryPitchRotationDirection(OFString &value, const signed long pos) const
485 {
486     if (EmptyDefaultItem)
487         return EC_IllegalCall;
488     else
489         return getStringValueFromElement(GantryPitchRotationDirection, value, pos);
490 }
491 
492 
getGantryRotationDirection(OFString & value,const signed long pos) const493 OFCondition DRTIonControlPointDeliverySequence::Item::getGantryRotationDirection(OFString &value, const signed long pos) const
494 {
495     if (EmptyDefaultItem)
496         return EC_IllegalCall;
497     else
498         return getStringValueFromElement(GantryRotationDirection, value, pos);
499 }
500 
501 
getHeadFixationAngle(Float32 & value,const unsigned long pos) const502 OFCondition DRTIonControlPointDeliverySequence::Item::getHeadFixationAngle(Float32 &value, const unsigned long pos) const
503 {
504     if (EmptyDefaultItem)
505         return EC_IllegalCall;
506     else
507         return OFconst_cast(DcmFloatingPointSingle &, HeadFixationAngle).getFloat32(value, pos);
508 }
509 
510 
getKVP(OFString & value,const signed long pos) const511 OFCondition DRTIonControlPointDeliverySequence::Item::getKVP(OFString &value, const signed long pos) const
512 {
513     if (EmptyDefaultItem)
514         return EC_IllegalCall;
515     else
516         return getStringValueFromElement(KVP, value, pos);
517 }
518 
519 
getKVP(Float64 & value,const unsigned long pos) const520 OFCondition DRTIonControlPointDeliverySequence::Item::getKVP(Float64 &value, const unsigned long pos) const
521 {
522     if (EmptyDefaultItem)
523         return EC_IllegalCall;
524     else
525         return OFconst_cast(DcmDecimalString &, KVP).getFloat64(value, pos);
526 }
527 
528 
getMetersetRateDelivered(Float32 & value,const unsigned long pos) const529 OFCondition DRTIonControlPointDeliverySequence::Item::getMetersetRateDelivered(Float32 &value, const unsigned long pos) const
530 {
531     if (EmptyDefaultItem)
532         return EC_IllegalCall;
533     else
534         return OFconst_cast(DcmFloatingPointSingle &, MetersetRateDelivered).getFloat32(value, pos);
535 }
536 
537 
getMetersetRateSet(Float32 & value,const unsigned long pos) const538 OFCondition DRTIonControlPointDeliverySequence::Item::getMetersetRateSet(Float32 &value, const unsigned long pos) const
539 {
540     if (EmptyDefaultItem)
541         return EC_IllegalCall;
542     else
543         return OFconst_cast(DcmFloatingPointSingle &, MetersetRateSet).getFloat32(value, pos);
544 }
545 
546 
getNominalBeamEnergy(OFString & value,const signed long pos) const547 OFCondition DRTIonControlPointDeliverySequence::Item::getNominalBeamEnergy(OFString &value, const signed long pos) const
548 {
549     if (EmptyDefaultItem)
550         return EC_IllegalCall;
551     else
552         return getStringValueFromElement(NominalBeamEnergy, value, pos);
553 }
554 
555 
getNominalBeamEnergy(Float64 & value,const unsigned long pos) const556 OFCondition DRTIonControlPointDeliverySequence::Item::getNominalBeamEnergy(Float64 &value, const unsigned long pos) const
557 {
558     if (EmptyDefaultItem)
559         return EC_IllegalCall;
560     else
561         return OFconst_cast(DcmDecimalString &, NominalBeamEnergy).getFloat64(value, pos);
562 }
563 
564 
getNumberOfPaintings(OFString & value,const signed long pos) const565 OFCondition DRTIonControlPointDeliverySequence::Item::getNumberOfPaintings(OFString &value, const signed long pos) const
566 {
567     if (EmptyDefaultItem)
568         return EC_IllegalCall;
569     else
570         return getStringValueFromElement(NumberOfPaintings, value, pos);
571 }
572 
573 
getNumberOfPaintings(Sint32 & value,const unsigned long pos) const574 OFCondition DRTIonControlPointDeliverySequence::Item::getNumberOfPaintings(Sint32 &value, const unsigned long pos) const
575 {
576     if (EmptyDefaultItem)
577         return EC_IllegalCall;
578     else
579         return OFconst_cast(DcmIntegerString &, NumberOfPaintings).getSint32(value, pos);
580 }
581 
582 
getNumberOfScanSpotPositions(OFString & value,const signed long pos) const583 OFCondition DRTIonControlPointDeliverySequence::Item::getNumberOfScanSpotPositions(OFString &value, const signed long pos) const
584 {
585     if (EmptyDefaultItem)
586         return EC_IllegalCall;
587     else
588         return getStringValueFromElement(NumberOfScanSpotPositions, value, pos);
589 }
590 
591 
getNumberOfScanSpotPositions(Sint32 & value,const unsigned long pos) const592 OFCondition DRTIonControlPointDeliverySequence::Item::getNumberOfScanSpotPositions(Sint32 &value, const unsigned long pos) const
593 {
594     if (EmptyDefaultItem)
595         return EC_IllegalCall;
596     else
597         return OFconst_cast(DcmIntegerString &, NumberOfScanSpotPositions).getSint32(value, pos);
598 }
599 
600 
getPatientSupportAngle(OFString & value,const signed long pos) const601 OFCondition DRTIonControlPointDeliverySequence::Item::getPatientSupportAngle(OFString &value, const signed long pos) const
602 {
603     if (EmptyDefaultItem)
604         return EC_IllegalCall;
605     else
606         return getStringValueFromElement(PatientSupportAngle, value, pos);
607 }
608 
609 
getPatientSupportAngle(Float64 & value,const unsigned long pos) const610 OFCondition DRTIonControlPointDeliverySequence::Item::getPatientSupportAngle(Float64 &value, const unsigned long pos) const
611 {
612     if (EmptyDefaultItem)
613         return EC_IllegalCall;
614     else
615         return OFconst_cast(DcmDecimalString &, PatientSupportAngle).getFloat64(value, pos);
616 }
617 
618 
getPatientSupportRotationDirection(OFString & value,const signed long pos) const619 OFCondition DRTIonControlPointDeliverySequence::Item::getPatientSupportRotationDirection(OFString &value, const signed long pos) const
620 {
621     if (EmptyDefaultItem)
622         return EC_IllegalCall;
623     else
624         return getStringValueFromElement(PatientSupportRotationDirection, value, pos);
625 }
626 
627 
getReferencedControlPointIndex(OFString & value,const signed long pos) const628 OFCondition DRTIonControlPointDeliverySequence::Item::getReferencedControlPointIndex(OFString &value, const signed long pos) const
629 {
630     if (EmptyDefaultItem)
631         return EC_IllegalCall;
632     else
633         return getStringValueFromElement(ReferencedControlPointIndex, value, pos);
634 }
635 
636 
getReferencedControlPointIndex(Sint32 & value,const unsigned long pos) const637 OFCondition DRTIonControlPointDeliverySequence::Item::getReferencedControlPointIndex(Sint32 &value, const unsigned long pos) const
638 {
639     if (EmptyDefaultItem)
640         return EC_IllegalCall;
641     else
642         return OFconst_cast(DcmIntegerString &, ReferencedControlPointIndex).getSint32(value, pos);
643 }
644 
645 
getScanSpotMetersetsDelivered(Float32 & value,const unsigned long pos) const646 OFCondition DRTIonControlPointDeliverySequence::Item::getScanSpotMetersetsDelivered(Float32 &value, const unsigned long pos) const
647 {
648     if (EmptyDefaultItem)
649         return EC_IllegalCall;
650     else
651         return OFconst_cast(DcmFloatingPointSingle &, ScanSpotMetersetsDelivered).getFloat32(value, pos);
652 }
653 
654 
getScanSpotPositionMap(Float32 & value,const unsigned long pos) const655 OFCondition DRTIonControlPointDeliverySequence::Item::getScanSpotPositionMap(Float32 &value, const unsigned long pos) const
656 {
657     if (EmptyDefaultItem)
658         return EC_IllegalCall;
659     else
660         return OFconst_cast(DcmFloatingPointSingle &, ScanSpotPositionMap).getFloat32(value, pos);
661 }
662 
663 
getScanSpotPrescribedIndices(OFString & value,const signed long pos) const664 OFCondition DRTIonControlPointDeliverySequence::Item::getScanSpotPrescribedIndices(OFString &value, const signed long pos) const
665 {
666     if (EmptyDefaultItem)
667         return EC_IllegalCall;
668     else
669         return getStringValueFromElement(ScanSpotPrescribedIndices, value, pos);
670 }
671 
672 
getScanSpotPrescribedIndices(Sint32 & value,const unsigned long pos) const673 OFCondition DRTIonControlPointDeliverySequence::Item::getScanSpotPrescribedIndices(Sint32 &value, const unsigned long pos) const
674 {
675     if (EmptyDefaultItem)
676         return EC_IllegalCall;
677     else
678         return OFconst_cast(DcmIntegerString &, ScanSpotPrescribedIndices).getSint32(value, pos);
679 }
680 
681 
getScanSpotReordered(OFString & value,const signed long pos) const682 OFCondition DRTIonControlPointDeliverySequence::Item::getScanSpotReordered(OFString &value, const signed long pos) const
683 {
684     if (EmptyDefaultItem)
685         return EC_IllegalCall;
686     else
687         return getStringValueFromElement(ScanSpotReordered, value, pos);
688 }
689 
690 
getScanSpotTimeOffset(Float32 & value,const unsigned long pos) const691 OFCondition DRTIonControlPointDeliverySequence::Item::getScanSpotTimeOffset(Float32 &value, const unsigned long pos) const
692 {
693     if (EmptyDefaultItem)
694         return EC_IllegalCall;
695     else
696         return OFconst_cast(DcmFloatingPointSingle &, ScanSpotTimeOffset).getFloat32(value, pos);
697 }
698 
699 
getScanSpotTuneID(OFString & value,const signed long pos) const700 OFCondition DRTIonControlPointDeliverySequence::Item::getScanSpotTuneID(OFString &value, const signed long pos) const
701 {
702     if (EmptyDefaultItem)
703         return EC_IllegalCall;
704     else
705         return getStringValueFromElement(ScanSpotTuneID, value, pos);
706 }
707 
708 
getScanningSpotSize(Float32 & value,const unsigned long pos) const709 OFCondition DRTIonControlPointDeliverySequence::Item::getScanningSpotSize(Float32 &value, const unsigned long pos) const
710 {
711     if (EmptyDefaultItem)
712         return EC_IllegalCall;
713     else
714         return OFconst_cast(DcmFloatingPointSingle &, ScanningSpotSize).getFloat32(value, pos);
715 }
716 
717 
getSnoutPosition(Float32 & value,const unsigned long pos) const718 OFCondition DRTIonControlPointDeliverySequence::Item::getSnoutPosition(Float32 &value, const unsigned long pos) const
719 {
720     if (EmptyDefaultItem)
721         return EC_IllegalCall;
722     else
723         return OFconst_cast(DcmFloatingPointSingle &, SnoutPosition).getFloat32(value, pos);
724 }
725 
726 
getSpecifiedMeterset(OFString & value,const signed long pos) const727 OFCondition DRTIonControlPointDeliverySequence::Item::getSpecifiedMeterset(OFString &value, const signed long pos) const
728 {
729     if (EmptyDefaultItem)
730         return EC_IllegalCall;
731     else
732         return getStringValueFromElement(SpecifiedMeterset, value, pos);
733 }
734 
735 
getSpecifiedMeterset(Float64 & value,const unsigned long pos) const736 OFCondition DRTIonControlPointDeliverySequence::Item::getSpecifiedMeterset(Float64 &value, const unsigned long pos) const
737 {
738     if (EmptyDefaultItem)
739         return EC_IllegalCall;
740     else
741         return OFconst_cast(DcmDecimalString &, SpecifiedMeterset).getFloat64(value, pos);
742 }
743 
744 
getTableTopLateralPosition(OFString & value,const signed long pos) const745 OFCondition DRTIonControlPointDeliverySequence::Item::getTableTopLateralPosition(OFString &value, const signed long pos) const
746 {
747     if (EmptyDefaultItem)
748         return EC_IllegalCall;
749     else
750         return getStringValueFromElement(TableTopLateralPosition, value, pos);
751 }
752 
753 
getTableTopLateralPosition(Float64 & value,const unsigned long pos) const754 OFCondition DRTIonControlPointDeliverySequence::Item::getTableTopLateralPosition(Float64 &value, const unsigned long pos) const
755 {
756     if (EmptyDefaultItem)
757         return EC_IllegalCall;
758     else
759         return OFconst_cast(DcmDecimalString &, TableTopLateralPosition).getFloat64(value, pos);
760 }
761 
762 
getTableTopLongitudinalPosition(OFString & value,const signed long pos) const763 OFCondition DRTIonControlPointDeliverySequence::Item::getTableTopLongitudinalPosition(OFString &value, const signed long pos) const
764 {
765     if (EmptyDefaultItem)
766         return EC_IllegalCall;
767     else
768         return getStringValueFromElement(TableTopLongitudinalPosition, value, pos);
769 }
770 
771 
getTableTopLongitudinalPosition(Float64 & value,const unsigned long pos) const772 OFCondition DRTIonControlPointDeliverySequence::Item::getTableTopLongitudinalPosition(Float64 &value, const unsigned long pos) const
773 {
774     if (EmptyDefaultItem)
775         return EC_IllegalCall;
776     else
777         return OFconst_cast(DcmDecimalString &, TableTopLongitudinalPosition).getFloat64(value, pos);
778 }
779 
780 
getTableTopPitchAngle(Float32 & value,const unsigned long pos) const781 OFCondition DRTIonControlPointDeliverySequence::Item::getTableTopPitchAngle(Float32 &value, const unsigned long pos) const
782 {
783     if (EmptyDefaultItem)
784         return EC_IllegalCall;
785     else
786         return OFconst_cast(DcmFloatingPointSingle &, TableTopPitchAngle).getFloat32(value, pos);
787 }
788 
789 
getTableTopPitchRotationDirection(OFString & value,const signed long pos) const790 OFCondition DRTIonControlPointDeliverySequence::Item::getTableTopPitchRotationDirection(OFString &value, const signed long pos) const
791 {
792     if (EmptyDefaultItem)
793         return EC_IllegalCall;
794     else
795         return getStringValueFromElement(TableTopPitchRotationDirection, value, pos);
796 }
797 
798 
getTableTopRollAngle(Float32 & value,const unsigned long pos) const799 OFCondition DRTIonControlPointDeliverySequence::Item::getTableTopRollAngle(Float32 &value, const unsigned long pos) const
800 {
801     if (EmptyDefaultItem)
802         return EC_IllegalCall;
803     else
804         return OFconst_cast(DcmFloatingPointSingle &, TableTopRollAngle).getFloat32(value, pos);
805 }
806 
807 
getTableTopRollRotationDirection(OFString & value,const signed long pos) const808 OFCondition DRTIonControlPointDeliverySequence::Item::getTableTopRollRotationDirection(OFString &value, const signed long pos) const
809 {
810     if (EmptyDefaultItem)
811         return EC_IllegalCall;
812     else
813         return getStringValueFromElement(TableTopRollRotationDirection, value, pos);
814 }
815 
816 
getTableTopVerticalPosition(OFString & value,const signed long pos) const817 OFCondition DRTIonControlPointDeliverySequence::Item::getTableTopVerticalPosition(OFString &value, const signed long pos) const
818 {
819     if (EmptyDefaultItem)
820         return EC_IllegalCall;
821     else
822         return getStringValueFromElement(TableTopVerticalPosition, value, pos);
823 }
824 
825 
getTableTopVerticalPosition(Float64 & value,const unsigned long pos) const826 OFCondition DRTIonControlPointDeliverySequence::Item::getTableTopVerticalPosition(Float64 &value, const unsigned long pos) const
827 {
828     if (EmptyDefaultItem)
829         return EC_IllegalCall;
830     else
831         return OFconst_cast(DcmDecimalString &, TableTopVerticalPosition).getFloat64(value, pos);
832 }
833 
834 
getTreatmentControlPointDate(OFString & value,const signed long pos) const835 OFCondition DRTIonControlPointDeliverySequence::Item::getTreatmentControlPointDate(OFString &value, const signed long pos) const
836 {
837     if (EmptyDefaultItem)
838         return EC_IllegalCall;
839     else
840         return getStringValueFromElement(TreatmentControlPointDate, value, pos);
841 }
842 
843 
getTreatmentControlPointTime(OFString & value,const signed long pos) const844 OFCondition DRTIonControlPointDeliverySequence::Item::getTreatmentControlPointTime(OFString &value, const signed long pos) const
845 {
846     if (EmptyDefaultItem)
847         return EC_IllegalCall;
848     else
849         return getStringValueFromElement(TreatmentControlPointTime, value, pos);
850 }
851 
852 
setBeamLimitingDeviceAngle(const OFString & value,const OFBool check)853 OFCondition DRTIonControlPointDeliverySequence::Item::setBeamLimitingDeviceAngle(const OFString &value, const OFBool check)
854 {
855     OFCondition result = EC_IllegalCall;
856     if (!EmptyDefaultItem)
857     {
858         result = (check) ? DcmDecimalString::checkStringValue(value, "1") : EC_Normal;
859         if (result.good())
860             result = BeamLimitingDeviceAngle.putOFStringArray(value);
861     }
862     return result;
863 }
864 
865 
setBeamLimitingDeviceRotationDirection(const OFString & value,const OFBool check)866 OFCondition DRTIonControlPointDeliverySequence::Item::setBeamLimitingDeviceRotationDirection(const OFString &value, const OFBool check)
867 {
868     OFCondition result = EC_IllegalCall;
869     if (!EmptyDefaultItem)
870     {
871         result = (check) ? DcmCodeString::checkStringValue(value, "1") : EC_Normal;
872         if (result.good())
873             result = BeamLimitingDeviceRotationDirection.putOFStringArray(value);
874     }
875     return result;
876 }
877 
878 
setChairHeadFramePosition(const OFString & value,const OFBool check)879 OFCondition DRTIonControlPointDeliverySequence::Item::setChairHeadFramePosition(const OFString &value, const OFBool check)
880 {
881     OFCondition result = EC_IllegalCall;
882     if (!EmptyDefaultItem)
883     {
884         result = (check) ? DcmDecimalString::checkStringValue(value, "1") : EC_Normal;
885         if (result.good())
886             result = ChairHeadFramePosition.putOFStringArray(value);
887     }
888     return result;
889 }
890 
891 
setDeliveredMeterset(const OFString & value,const OFBool check)892 OFCondition DRTIonControlPointDeliverySequence::Item::setDeliveredMeterset(const OFString &value, const OFBool check)
893 {
894     OFCondition result = EC_IllegalCall;
895     if (!EmptyDefaultItem)
896     {
897         result = (check) ? DcmDecimalString::checkStringValue(value, "1") : EC_Normal;
898         if (result.good())
899             result = DeliveredMeterset.putOFStringArray(value);
900     }
901     return result;
902 }
903 
904 
setGantryAngle(const OFString & value,const OFBool check)905 OFCondition DRTIonControlPointDeliverySequence::Item::setGantryAngle(const OFString &value, const OFBool check)
906 {
907     OFCondition result = EC_IllegalCall;
908     if (!EmptyDefaultItem)
909     {
910         result = (check) ? DcmDecimalString::checkStringValue(value, "1") : EC_Normal;
911         if (result.good())
912             result = GantryAngle.putOFStringArray(value);
913     }
914     return result;
915 }
916 
917 
setGantryPitchAngle(const Float32 value,const unsigned long pos)918 OFCondition DRTIonControlPointDeliverySequence::Item::setGantryPitchAngle(const Float32 value, const unsigned long pos)
919 {
920     if (EmptyDefaultItem)
921         return EC_IllegalCall;
922     else
923         return GantryPitchAngle.putFloat32(value, pos);
924 }
925 
926 
setGantryPitchRotationDirection(const OFString & value,const OFBool check)927 OFCondition DRTIonControlPointDeliverySequence::Item::setGantryPitchRotationDirection(const OFString &value, const OFBool check)
928 {
929     OFCondition result = EC_IllegalCall;
930     if (!EmptyDefaultItem)
931     {
932         result = (check) ? DcmCodeString::checkStringValue(value, "1") : EC_Normal;
933         if (result.good())
934             result = GantryPitchRotationDirection.putOFStringArray(value);
935     }
936     return result;
937 }
938 
939 
setGantryRotationDirection(const OFString & value,const OFBool check)940 OFCondition DRTIonControlPointDeliverySequence::Item::setGantryRotationDirection(const OFString &value, const OFBool check)
941 {
942     OFCondition result = EC_IllegalCall;
943     if (!EmptyDefaultItem)
944     {
945         result = (check) ? DcmCodeString::checkStringValue(value, "1") : EC_Normal;
946         if (result.good())
947             result = GantryRotationDirection.putOFStringArray(value);
948     }
949     return result;
950 }
951 
952 
setHeadFixationAngle(const Float32 value,const unsigned long pos)953 OFCondition DRTIonControlPointDeliverySequence::Item::setHeadFixationAngle(const Float32 value, const unsigned long pos)
954 {
955     if (EmptyDefaultItem)
956         return EC_IllegalCall;
957     else
958         return HeadFixationAngle.putFloat32(value, pos);
959 }
960 
961 
setKVP(const OFString & value,const OFBool check)962 OFCondition DRTIonControlPointDeliverySequence::Item::setKVP(const OFString &value, const OFBool check)
963 {
964     OFCondition result = EC_IllegalCall;
965     if (!EmptyDefaultItem)
966     {
967         result = (check) ? DcmDecimalString::checkStringValue(value, "1") : EC_Normal;
968         if (result.good())
969             result = KVP.putOFStringArray(value);
970     }
971     return result;
972 }
973 
974 
setMetersetRateDelivered(const Float32 value,const unsigned long pos)975 OFCondition DRTIonControlPointDeliverySequence::Item::setMetersetRateDelivered(const Float32 value, const unsigned long pos)
976 {
977     if (EmptyDefaultItem)
978         return EC_IllegalCall;
979     else
980         return MetersetRateDelivered.putFloat32(value, pos);
981 }
982 
983 
setMetersetRateSet(const Float32 value,const unsigned long pos)984 OFCondition DRTIonControlPointDeliverySequence::Item::setMetersetRateSet(const Float32 value, const unsigned long pos)
985 {
986     if (EmptyDefaultItem)
987         return EC_IllegalCall;
988     else
989         return MetersetRateSet.putFloat32(value, pos);
990 }
991 
992 
setNominalBeamEnergy(const OFString & value,const OFBool check)993 OFCondition DRTIonControlPointDeliverySequence::Item::setNominalBeamEnergy(const OFString &value, const OFBool check)
994 {
995     OFCondition result = EC_IllegalCall;
996     if (!EmptyDefaultItem)
997     {
998         result = (check) ? DcmDecimalString::checkStringValue(value, "1") : EC_Normal;
999         if (result.good())
1000             result = NominalBeamEnergy.putOFStringArray(value);
1001     }
1002     return result;
1003 }
1004 
1005 
setNumberOfPaintings(const OFString & value,const OFBool check)1006 OFCondition DRTIonControlPointDeliverySequence::Item::setNumberOfPaintings(const OFString &value, const OFBool check)
1007 {
1008     OFCondition result = EC_IllegalCall;
1009     if (!EmptyDefaultItem)
1010     {
1011         result = (check) ? DcmIntegerString::checkStringValue(value, "1") : EC_Normal;
1012         if (result.good())
1013             result = NumberOfPaintings.putOFStringArray(value);
1014     }
1015     return result;
1016 }
1017 
1018 
setNumberOfScanSpotPositions(const OFString & value,const OFBool check)1019 OFCondition DRTIonControlPointDeliverySequence::Item::setNumberOfScanSpotPositions(const OFString &value, const OFBool check)
1020 {
1021     OFCondition result = EC_IllegalCall;
1022     if (!EmptyDefaultItem)
1023     {
1024         result = (check) ? DcmIntegerString::checkStringValue(value, "1") : EC_Normal;
1025         if (result.good())
1026             result = NumberOfScanSpotPositions.putOFStringArray(value);
1027     }
1028     return result;
1029 }
1030 
1031 
setPatientSupportAngle(const OFString & value,const OFBool check)1032 OFCondition DRTIonControlPointDeliverySequence::Item::setPatientSupportAngle(const OFString &value, const OFBool check)
1033 {
1034     OFCondition result = EC_IllegalCall;
1035     if (!EmptyDefaultItem)
1036     {
1037         result = (check) ? DcmDecimalString::checkStringValue(value, "1") : EC_Normal;
1038         if (result.good())
1039             result = PatientSupportAngle.putOFStringArray(value);
1040     }
1041     return result;
1042 }
1043 
1044 
setPatientSupportRotationDirection(const OFString & value,const OFBool check)1045 OFCondition DRTIonControlPointDeliverySequence::Item::setPatientSupportRotationDirection(const OFString &value, const OFBool check)
1046 {
1047     OFCondition result = EC_IllegalCall;
1048     if (!EmptyDefaultItem)
1049     {
1050         result = (check) ? DcmCodeString::checkStringValue(value, "1") : EC_Normal;
1051         if (result.good())
1052             result = PatientSupportRotationDirection.putOFStringArray(value);
1053     }
1054     return result;
1055 }
1056 
1057 
setReferencedControlPointIndex(const OFString & value,const OFBool check)1058 OFCondition DRTIonControlPointDeliverySequence::Item::setReferencedControlPointIndex(const OFString &value, const OFBool check)
1059 {
1060     OFCondition result = EC_IllegalCall;
1061     if (!EmptyDefaultItem)
1062     {
1063         result = (check) ? DcmIntegerString::checkStringValue(value, "1") : EC_Normal;
1064         if (result.good())
1065             result = ReferencedControlPointIndex.putOFStringArray(value);
1066     }
1067     return result;
1068 }
1069 
1070 
setScanSpotMetersetsDelivered(const Float32 value,const unsigned long pos)1071 OFCondition DRTIonControlPointDeliverySequence::Item::setScanSpotMetersetsDelivered(const Float32 value, const unsigned long pos)
1072 {
1073     if (EmptyDefaultItem)
1074         return EC_IllegalCall;
1075     else
1076         return ScanSpotMetersetsDelivered.putFloat32(value, pos);
1077 }
1078 
1079 
setScanSpotPositionMap(const Float32 value,const unsigned long pos)1080 OFCondition DRTIonControlPointDeliverySequence::Item::setScanSpotPositionMap(const Float32 value, const unsigned long pos)
1081 {
1082     if (EmptyDefaultItem)
1083         return EC_IllegalCall;
1084     else
1085         return ScanSpotPositionMap.putFloat32(value, pos);
1086 }
1087 
1088 
setScanSpotPrescribedIndices(const OFString & value,const OFBool check)1089 OFCondition DRTIonControlPointDeliverySequence::Item::setScanSpotPrescribedIndices(const OFString &value, const OFBool check)
1090 {
1091     OFCondition result = EC_IllegalCall;
1092     if (!EmptyDefaultItem)
1093     {
1094         result = (check) ? DcmIntegerString::checkStringValue(value, "1-n") : EC_Normal;
1095         if (result.good())
1096             result = ScanSpotPrescribedIndices.putOFStringArray(value);
1097     }
1098     return result;
1099 }
1100 
1101 
setScanSpotReordered(const OFString & value,const OFBool check)1102 OFCondition DRTIonControlPointDeliverySequence::Item::setScanSpotReordered(const OFString &value, const OFBool check)
1103 {
1104     OFCondition result = EC_IllegalCall;
1105     if (!EmptyDefaultItem)
1106     {
1107         result = (check) ? DcmCodeString::checkStringValue(value, "1") : EC_Normal;
1108         if (result.good())
1109             result = ScanSpotReordered.putOFStringArray(value);
1110     }
1111     return result;
1112 }
1113 
1114 
setScanSpotTimeOffset(const Float32 value,const unsigned long pos)1115 OFCondition DRTIonControlPointDeliverySequence::Item::setScanSpotTimeOffset(const Float32 value, const unsigned long pos)
1116 {
1117     if (EmptyDefaultItem)
1118         return EC_IllegalCall;
1119     else
1120         return ScanSpotTimeOffset.putFloat32(value, pos);
1121 }
1122 
1123 
setScanSpotTuneID(const OFString & value,const OFBool check)1124 OFCondition DRTIonControlPointDeliverySequence::Item::setScanSpotTuneID(const OFString &value, const OFBool check)
1125 {
1126     OFCondition result = EC_IllegalCall;
1127     if (!EmptyDefaultItem)
1128     {
1129         result = (check) ? DcmShortString::checkStringValue(value, "1") : EC_Normal;
1130         if (result.good())
1131             result = ScanSpotTuneID.putOFStringArray(value);
1132     }
1133     return result;
1134 }
1135 
1136 
setScanningSpotSize(const Float32 value,const unsigned long pos)1137 OFCondition DRTIonControlPointDeliverySequence::Item::setScanningSpotSize(const Float32 value, const unsigned long pos)
1138 {
1139     if (EmptyDefaultItem)
1140         return EC_IllegalCall;
1141     else
1142         return ScanningSpotSize.putFloat32(value, pos);
1143 }
1144 
1145 
setSnoutPosition(const Float32 value,const unsigned long pos)1146 OFCondition DRTIonControlPointDeliverySequence::Item::setSnoutPosition(const Float32 value, const unsigned long pos)
1147 {
1148     if (EmptyDefaultItem)
1149         return EC_IllegalCall;
1150     else
1151         return SnoutPosition.putFloat32(value, pos);
1152 }
1153 
1154 
setSpecifiedMeterset(const OFString & value,const OFBool check)1155 OFCondition DRTIonControlPointDeliverySequence::Item::setSpecifiedMeterset(const OFString &value, const OFBool check)
1156 {
1157     OFCondition result = EC_IllegalCall;
1158     if (!EmptyDefaultItem)
1159     {
1160         result = (check) ? DcmDecimalString::checkStringValue(value, "1") : EC_Normal;
1161         if (result.good())
1162             result = SpecifiedMeterset.putOFStringArray(value);
1163     }
1164     return result;
1165 }
1166 
1167 
setTableTopLateralPosition(const OFString & value,const OFBool check)1168 OFCondition DRTIonControlPointDeliverySequence::Item::setTableTopLateralPosition(const OFString &value, const OFBool check)
1169 {
1170     OFCondition result = EC_IllegalCall;
1171     if (!EmptyDefaultItem)
1172     {
1173         result = (check) ? DcmDecimalString::checkStringValue(value, "1") : EC_Normal;
1174         if (result.good())
1175             result = TableTopLateralPosition.putOFStringArray(value);
1176     }
1177     return result;
1178 }
1179 
1180 
setTableTopLongitudinalPosition(const OFString & value,const OFBool check)1181 OFCondition DRTIonControlPointDeliverySequence::Item::setTableTopLongitudinalPosition(const OFString &value, const OFBool check)
1182 {
1183     OFCondition result = EC_IllegalCall;
1184     if (!EmptyDefaultItem)
1185     {
1186         result = (check) ? DcmDecimalString::checkStringValue(value, "1") : EC_Normal;
1187         if (result.good())
1188             result = TableTopLongitudinalPosition.putOFStringArray(value);
1189     }
1190     return result;
1191 }
1192 
1193 
setTableTopPitchAngle(const Float32 value,const unsigned long pos)1194 OFCondition DRTIonControlPointDeliverySequence::Item::setTableTopPitchAngle(const Float32 value, const unsigned long pos)
1195 {
1196     if (EmptyDefaultItem)
1197         return EC_IllegalCall;
1198     else
1199         return TableTopPitchAngle.putFloat32(value, pos);
1200 }
1201 
1202 
setTableTopPitchRotationDirection(const OFString & value,const OFBool check)1203 OFCondition DRTIonControlPointDeliverySequence::Item::setTableTopPitchRotationDirection(const OFString &value, const OFBool check)
1204 {
1205     OFCondition result = EC_IllegalCall;
1206     if (!EmptyDefaultItem)
1207     {
1208         result = (check) ? DcmCodeString::checkStringValue(value, "1") : EC_Normal;
1209         if (result.good())
1210             result = TableTopPitchRotationDirection.putOFStringArray(value);
1211     }
1212     return result;
1213 }
1214 
1215 
setTableTopRollAngle(const Float32 value,const unsigned long pos)1216 OFCondition DRTIonControlPointDeliverySequence::Item::setTableTopRollAngle(const Float32 value, const unsigned long pos)
1217 {
1218     if (EmptyDefaultItem)
1219         return EC_IllegalCall;
1220     else
1221         return TableTopRollAngle.putFloat32(value, pos);
1222 }
1223 
1224 
setTableTopRollRotationDirection(const OFString & value,const OFBool check)1225 OFCondition DRTIonControlPointDeliverySequence::Item::setTableTopRollRotationDirection(const OFString &value, const OFBool check)
1226 {
1227     OFCondition result = EC_IllegalCall;
1228     if (!EmptyDefaultItem)
1229     {
1230         result = (check) ? DcmCodeString::checkStringValue(value, "1") : EC_Normal;
1231         if (result.good())
1232             result = TableTopRollRotationDirection.putOFStringArray(value);
1233     }
1234     return result;
1235 }
1236 
1237 
setTableTopVerticalPosition(const OFString & value,const OFBool check)1238 OFCondition DRTIonControlPointDeliverySequence::Item::setTableTopVerticalPosition(const OFString &value, const OFBool check)
1239 {
1240     OFCondition result = EC_IllegalCall;
1241     if (!EmptyDefaultItem)
1242     {
1243         result = (check) ? DcmDecimalString::checkStringValue(value, "1") : EC_Normal;
1244         if (result.good())
1245             result = TableTopVerticalPosition.putOFStringArray(value);
1246     }
1247     return result;
1248 }
1249 
1250 
setTreatmentControlPointDate(const OFString & value,const OFBool check)1251 OFCondition DRTIonControlPointDeliverySequence::Item::setTreatmentControlPointDate(const OFString &value, const OFBool check)
1252 {
1253     OFCondition result = EC_IllegalCall;
1254     if (!EmptyDefaultItem)
1255     {
1256         result = (check) ? DcmDate::checkStringValue(value, "1") : EC_Normal;
1257         if (result.good())
1258             result = TreatmentControlPointDate.putOFStringArray(value);
1259     }
1260     return result;
1261 }
1262 
1263 
setTreatmentControlPointTime(const OFString & value,const OFBool check)1264 OFCondition DRTIonControlPointDeliverySequence::Item::setTreatmentControlPointTime(const OFString &value, const OFBool check)
1265 {
1266     OFCondition result = EC_IllegalCall;
1267     if (!EmptyDefaultItem)
1268     {
1269         result = (check) ? DcmTime::checkStringValue(value, "1") : EC_Normal;
1270         if (result.good())
1271             result = TreatmentControlPointTime.putOFStringArray(value);
1272     }
1273     return result;
1274 }
1275 
1276 
1277 // --- sequence class ---
1278 
DRTIonControlPointDeliverySequence(const OFBool emptyDefaultSequence)1279 DRTIonControlPointDeliverySequence::DRTIonControlPointDeliverySequence(const OFBool emptyDefaultSequence)
1280   : EmptyDefaultSequence(emptyDefaultSequence),
1281     SequenceOfItems(),
1282     CurrentItem(),
1283     EmptyItem(OFTrue /*emptyDefaultItem*/)
1284 {
1285     CurrentItem = SequenceOfItems.end();
1286 }
1287 
1288 
DRTIonControlPointDeliverySequence(const DRTIonControlPointDeliverySequence & copy)1289 DRTIonControlPointDeliverySequence::DRTIonControlPointDeliverySequence(const DRTIonControlPointDeliverySequence &copy)
1290   : EmptyDefaultSequence(copy.EmptyDefaultSequence),
1291     SequenceOfItems(),
1292     CurrentItem(),
1293     EmptyItem(OFTrue /*emptyDefaultItem*/)
1294 {
1295     /* create a copy of the internal sequence of items */
1296     Item *item = NULL;
1297     OFListConstIterator(Item *) current = copy.SequenceOfItems.begin();
1298     const OFListConstIterator(Item *) last = copy.SequenceOfItems.end();
1299     while (current != last)
1300     {
1301         item = new Item(**current);
1302         if (item != NULL)
1303         {
1304             SequenceOfItems.push_back(item);
1305         } else {
1306             /* memory exhausted, there is nothing we can do about it */
1307             break;
1308         }
1309         ++current;
1310     }
1311     CurrentItem = SequenceOfItems.begin();
1312 }
1313 
1314 
operator =(const DRTIonControlPointDeliverySequence & copy)1315 DRTIonControlPointDeliverySequence &DRTIonControlPointDeliverySequence::operator=(const DRTIonControlPointDeliverySequence &copy)
1316 {
1317     if (this != &copy)
1318     {
1319         clear();
1320         EmptyDefaultSequence = copy.EmptyDefaultSequence;
1321         /* create a copy of the internal sequence of items */
1322         Item *item = NULL;
1323         OFListConstIterator(Item *) current = copy.SequenceOfItems.begin();
1324         const OFListConstIterator(Item *) last = copy.SequenceOfItems.end();
1325         while (current != last)
1326         {
1327             item = new Item(**current);
1328             if (item != NULL)
1329             {
1330                 SequenceOfItems.push_back(item);
1331             } else {
1332                 /* memory exhausted, there is nothing we can do about it */
1333                 break;
1334             }
1335             ++current;
1336         }
1337         CurrentItem = SequenceOfItems.begin();
1338     }
1339     return *this;
1340 }
1341 
1342 
~DRTIonControlPointDeliverySequence()1343 DRTIonControlPointDeliverySequence::~DRTIonControlPointDeliverySequence()
1344 {
1345     clear();
1346 }
1347 
1348 
clear()1349 void DRTIonControlPointDeliverySequence::clear()
1350 {
1351     if (!EmptyDefaultSequence)
1352     {
1353         CurrentItem = SequenceOfItems.begin();
1354         const OFListConstIterator(Item *) last = SequenceOfItems.end();
1355         /* delete all items and free memory */
1356         while (CurrentItem != last)
1357         {
1358             delete (*CurrentItem);
1359             CurrentItem = SequenceOfItems.erase(CurrentItem);
1360         }
1361         /* make sure that the list is empty */
1362         SequenceOfItems.clear();
1363         CurrentItem = SequenceOfItems.end();
1364     }
1365 }
1366 
1367 
isEmpty()1368 OFBool DRTIonControlPointDeliverySequence::isEmpty()
1369 {
1370     return SequenceOfItems.empty();
1371 }
1372 
1373 
isValid() const1374 OFBool DRTIonControlPointDeliverySequence::isValid() const
1375 {
1376     return !EmptyDefaultSequence;
1377 }
1378 
1379 
getNumberOfItems() const1380 size_t DRTIonControlPointDeliverySequence::getNumberOfItems() const
1381 {
1382     return SequenceOfItems.size();
1383 }
1384 
1385 
gotoFirstItem()1386 OFCondition DRTIonControlPointDeliverySequence::gotoFirstItem()
1387 {
1388     OFCondition result = EC_IllegalCall;
1389     if (!SequenceOfItems.empty())
1390     {
1391         CurrentItem = SequenceOfItems.begin();
1392         result = EC_Normal;
1393     }
1394     return result;
1395 }
1396 
1397 
gotoNextItem()1398 OFCondition DRTIonControlPointDeliverySequence::gotoNextItem()
1399 {
1400     OFCondition result = EC_IllegalCall;
1401     if (CurrentItem != SequenceOfItems.end())
1402     {
1403         ++CurrentItem;
1404         result = EC_Normal;
1405     }
1406     return result;
1407 }
1408 
1409 
gotoItem(const size_t num,OFListIterator (Item *)& iterator)1410 OFCondition DRTIonControlPointDeliverySequence::gotoItem(const size_t num, OFListIterator(Item *) &iterator)
1411 {
1412     OFCondition result = EC_IllegalCall;
1413     if (!SequenceOfItems.empty())
1414     {
1415         size_t idx = num + 1;
1416         iterator = SequenceOfItems.begin();
1417         const OFListConstIterator(Item *) last = SequenceOfItems.end();
1418         while ((--idx > 0) && (iterator != last))
1419             ++iterator;
1420         /* specified list item found? */
1421         if ((idx == 0) && (iterator != last))
1422             result = EC_Normal;
1423         else
1424             result = EC_IllegalParameter;
1425     }
1426     return result;
1427 }
1428 
1429 
gotoItem(const size_t num,OFListConstIterator (Item *)& iterator) const1430 OFCondition DRTIonControlPointDeliverySequence::gotoItem(const size_t num, OFListConstIterator(Item *) &iterator) const
1431 {
1432     OFCondition result = EC_IllegalCall;
1433     if (!SequenceOfItems.empty())
1434     {
1435         size_t idx = num + 1;
1436         iterator = SequenceOfItems.begin();
1437         const OFListConstIterator(Item *) last = SequenceOfItems.end();
1438         while ((--idx > 0) && (iterator != last))
1439             ++iterator;
1440         /* specified list item found? */
1441         if ((idx == 0) && (iterator != last))
1442             result = EC_Normal;
1443         else
1444             result = EC_IllegalParameter;
1445     }
1446     return result;
1447 }
1448 
1449 
gotoItem(const size_t num)1450 OFCondition DRTIonControlPointDeliverySequence::gotoItem(const size_t num)
1451 {
1452     return gotoItem(num, CurrentItem);
1453 }
1454 
1455 
getCurrentItem(Item * & item) const1456 OFCondition DRTIonControlPointDeliverySequence::getCurrentItem(Item *&item) const
1457 {
1458     OFCondition result = EC_IllegalCall;
1459     if (CurrentItem != SequenceOfItems.end())
1460     {
1461         item = *CurrentItem;
1462         result = EC_Normal;
1463     }
1464     return result;
1465 }
1466 
1467 
getCurrentItem()1468 DRTIonControlPointDeliverySequence::Item &DRTIonControlPointDeliverySequence::getCurrentItem()
1469 {
1470     if (CurrentItem != SequenceOfItems.end())
1471         return **CurrentItem;
1472     else
1473         return EmptyItem;
1474 }
1475 
1476 
getCurrentItem() const1477 const DRTIonControlPointDeliverySequence::Item &DRTIonControlPointDeliverySequence::getCurrentItem() const
1478 {
1479     if (CurrentItem != SequenceOfItems.end())
1480         return **CurrentItem;
1481     else
1482         return EmptyItem;
1483 }
1484 
1485 
getItem(const size_t num,Item * & item)1486 OFCondition DRTIonControlPointDeliverySequence::getItem(const size_t num, Item *&item)
1487 {
1488     OFListIterator(Item *) iterator;
1489     OFCondition result = gotoItem(num, iterator);
1490     if (result.good())
1491         item = *iterator;
1492     return result;
1493 }
1494 
1495 
getItem(const size_t num)1496 DRTIonControlPointDeliverySequence::Item &DRTIonControlPointDeliverySequence::getItem(const size_t num)
1497 {
1498     OFListIterator(Item *) iterator;
1499     if (gotoItem(num, iterator).good())
1500         return **iterator;
1501     else
1502         return EmptyItem;
1503 }
1504 
1505 
getItem(const size_t num) const1506 const DRTIonControlPointDeliverySequence::Item &DRTIonControlPointDeliverySequence::getItem(const size_t num) const
1507 {
1508     OFListConstIterator(Item *) iterator;
1509     if (gotoItem(num, iterator).good())
1510         return **iterator;
1511     else
1512         return EmptyItem;
1513 }
1514 
1515 
operator [](const size_t num)1516 DRTIonControlPointDeliverySequence::Item &DRTIonControlPointDeliverySequence::operator[](const size_t num)
1517 {
1518     return getItem(num);
1519 }
1520 
1521 
operator [](const size_t num) const1522 const DRTIonControlPointDeliverySequence::Item &DRTIonControlPointDeliverySequence::operator[](const size_t num) const
1523 {
1524     return getItem(num);
1525 }
1526 
1527 
addItem(Item * & item)1528 OFCondition DRTIonControlPointDeliverySequence::addItem(Item *&item)
1529 {
1530     OFCondition result = EC_IllegalCall;
1531     if (!EmptyDefaultSequence)
1532     {
1533         item = new Item();
1534         if (item != NULL)
1535         {
1536             SequenceOfItems.push_back(item);
1537             result = EC_Normal;
1538         } else
1539             result = EC_MemoryExhausted;
1540     }
1541     return result;
1542 }
1543 
1544 
insertItem(const size_t pos,Item * & item)1545 OFCondition DRTIonControlPointDeliverySequence::insertItem(const size_t pos, Item *&item)
1546 {
1547     OFCondition result = EC_IllegalCall;
1548     if (!EmptyDefaultSequence)
1549     {
1550         OFListIterator(Item *) iterator;
1551         result = gotoItem(pos, iterator);
1552         if (result.good())
1553         {
1554             item = new Item();
1555             if (item != NULL)
1556             {
1557                 SequenceOfItems.insert(iterator, 1, item);
1558                 result = EC_Normal;
1559             } else
1560                 result = EC_MemoryExhausted;
1561         } else
1562             result = addItem(item);
1563     }
1564     return result;
1565 }
1566 
1567 
removeItem(const size_t pos)1568 OFCondition DRTIonControlPointDeliverySequence::removeItem(const size_t pos)
1569 {
1570     OFCondition result = EC_IllegalCall;
1571     if (!EmptyDefaultSequence)
1572     {
1573         OFListIterator(Item *) iterator;
1574         if (gotoItem(pos, iterator).good())
1575         {
1576             delete *iterator;
1577             iterator = SequenceOfItems.erase(iterator);
1578             result = EC_Normal;
1579         } else
1580             result = EC_IllegalParameter;
1581     }
1582     return result;
1583 }
1584 
1585 
read(DcmItem & dataset,const OFString & card,const OFString & type,const char * moduleName)1586 OFCondition DRTIonControlPointDeliverySequence::read(DcmItem &dataset,
1587                                                      const OFString &card,
1588                                                      const OFString &type,
1589                                                      const char *moduleName)
1590 {
1591     OFCondition result = EC_IllegalCall;
1592     if (!EmptyDefaultSequence)
1593     {
1594         /* re-initialize object */
1595         clear();
1596         /* retrieve sequence element from dataset */
1597         DcmSequenceOfItems *sequence;
1598         result = dataset.findAndGetSequence(DCM_IonControlPointDeliverySequence, sequence);
1599         if (sequence != NULL)
1600         {
1601             if (checkElementValue(*sequence, card, type, result, moduleName))
1602             {
1603                 DcmStack stack;
1604                 OFBool first = OFTrue;
1605                 /* iterate over all sequence items */
1606                 while (result.good() && sequence->nextObject(stack, first /*intoSub*/).good())
1607                 {
1608                     DcmItem *ditem = OFstatic_cast(DcmItem *, stack.top());
1609                     if (ditem != NULL)
1610                     {
1611                         Item *item = new Item();
1612                         if (item != NULL)
1613                         {
1614                             result = item->read(*ditem);
1615                             if (result.good())
1616                             {
1617                                 /* append new item to the end of the list */
1618                                 SequenceOfItems.push_back(item);
1619                                 first = OFFalse;
1620                             }
1621                         } else
1622                             result = EC_MemoryExhausted;
1623                     } else
1624                         result = EC_CorruptedData;
1625                 }
1626             }
1627         } else {
1628             DcmSequenceOfItems element(DCM_IonControlPointDeliverySequence);
1629             checkElementValue(element, card, type, result, moduleName);
1630         }
1631     }
1632     return result;
1633 }
1634 
1635 
write(DcmItem & dataset,const OFString & card,const OFString & type,const char * moduleName)1636 OFCondition DRTIonControlPointDeliverySequence::write(DcmItem &dataset,
1637                                                       const OFString &card,
1638                                                       const OFString &type,
1639                                                       const char *moduleName)
1640 {
1641     OFCondition result = EC_IllegalCall;
1642     if (!EmptyDefaultSequence)
1643     {
1644         result = EC_MemoryExhausted;
1645         DcmSequenceOfItems *sequence = new DcmSequenceOfItems(DCM_IonControlPointDeliverySequence);
1646         if (sequence != NULL)
1647         {
1648             result = EC_Normal;
1649             /* an empty optional sequence is not written */
1650             if ((type == "2") || !SequenceOfItems.empty())
1651             {
1652                 OFListIterator(Item *) iterator = SequenceOfItems.begin();
1653                 const OFListConstIterator(Item *) last = SequenceOfItems.end();
1654                 /* iterate over all sequence items */
1655                 while (result.good() && (iterator != last))
1656                 {
1657                     DcmItem *item = new DcmItem();
1658                     if (item != NULL)
1659                     {
1660                         /* append new item to the end of the sequence */
1661                         result = sequence->append(item);
1662                         if (result.good())
1663                         {
1664                             result = (*iterator)->write(*item);
1665                             ++iterator;
1666                         } else
1667                             delete item;
1668                     } else
1669                         result = EC_MemoryExhausted;
1670                 }
1671                 if (result.good())
1672                 {
1673                     /* insert sequence element into the dataset */
1674                     result = dataset.insert(sequence, OFTrue /*replaceOld*/);
1675                 }
1676                 if (DCM_dcmrtLogger.isEnabledFor(OFLogger::WARN_LOG_LEVEL))
1677                     checkElementValue(*sequence, card, type, result, moduleName);
1678                 if (result.good())
1679                 {
1680                     /* forget reference to sequence object (avoid deletion below) */
1681                     sequence = NULL;
1682                 }
1683             }
1684             else if (type == "1")
1685             {
1686                 /* empty type 1 sequence not allowed */
1687                 result = RT_EC_InvalidValue;
1688                 if (DCM_dcmrtLogger.isEnabledFor(OFLogger::WARN_LOG_LEVEL))
1689                     checkElementValue(*sequence, card, type, result, moduleName);
1690             }
1691             /* delete sequence (if not inserted into the dataset) */
1692             delete sequence;
1693         }
1694     }
1695     return result;
1696 }
1697 
1698 
1699 // end of source file
1700