1 /*
2  *
3  *  Copyright (C) 1994-2002, OFFIS
4  *
5  *  This software and supporting documentation were developed by
6  *
7  *    Kuratorium OFFIS e.V.
8  *    Healthcare Information and Communication Systems
9  *    Escherweg 2
10  *    D-26121 Oldenburg, Germany
11  *
12  *  THIS SOFTWARE IS MADE AVAILABLE,  AS IS,  AND OFFIS MAKES NO  WARRANTY
13  *  REGARDING  THE  SOFTWARE,  ITS  PERFORMANCE,  ITS  MERCHANTABILITY  OR
14  *  FITNESS FOR ANY PARTICULAR USE, FREEDOM FROM ANY COMPUTER DISEASES  OR
15  *  ITS CONFORMITY TO ANY SPECIFICATION. THE ENTIRE RISK AS TO QUALITY AND
16  *  PERFORMANCE OF THE SOFTWARE IS WITH THE USER.
17  *
18  *  Module:  dcmdata
19  *
20  *  Author:  Gerd Ehlers, Andreas Barth
21  *
22  *  Purpose: Implementation of class DcmUnsignedLongOffset
23  *
24  */
25 
26 #include "osconfig.h"
27 #include "dcvrulup.h"
28 
29 #define INCLUDE_CSTDIO
30 #define INCLUDE_CSTRING
31 #include "ofstdinc.h"
32 
33 
34 // ********************************
35 
36 
DcmUnsignedLongOffset(const DcmTag & tag,const Uint32 len)37 DcmUnsignedLongOffset::DcmUnsignedLongOffset(const DcmTag &tag,
38                                              const Uint32 len)
39   : DcmUnsignedLong(tag, len),
40     nextRecord(NULL)
41 {
42 }
43 
44 
DcmUnsignedLongOffset(const DcmUnsignedLongOffset & old)45 DcmUnsignedLongOffset::DcmUnsignedLongOffset(const DcmUnsignedLongOffset &old)
46   : DcmUnsignedLong(old),
47     nextRecord(old.nextRecord)
48 {
49 }
50 
51 
~DcmUnsignedLongOffset()52 DcmUnsignedLongOffset::~DcmUnsignedLongOffset()
53 {
54 }
55 
56 
57 // ********************************
58 
59 
ident() const60 DcmEVR DcmUnsignedLongOffset::ident() const
61 {
62     /* internal type identifier */
63     return EVR_up;
64 }
65 
66 
clear()67 OFCondition DcmUnsignedLongOffset::clear()
68 {
69     /* call inherited method */
70     errorFlag = DcmUnsignedLong::clear();
71     /* remove reference to object */
72     nextRecord = NULL;
73     return errorFlag;
74 }
75 
76 
77 // ********************************
78 
79 
getNextRecord()80 DcmObject* DcmUnsignedLongOffset::getNextRecord()
81 {
82     errorFlag = EC_Normal;
83     /* return pointer to currently stored object reference */
84     return nextRecord;
85 }
86 
87 
setNextRecord(DcmObject * record)88 DcmObject *DcmUnsignedLongOffset::setNextRecord(DcmObject *record)
89 {
90     errorFlag = EC_Normal;
91     /* store new object reference */
92     nextRecord = record;
93     return record;
94 }
95 
96 
97 // ********************************
98 
99 
verify(const OFBool autocorrect)100 OFCondition DcmUnsignedLongOffset::verify(const OFBool autocorrect)
101 {
102     /* call inherited method */
103     errorFlag = DcmUnsignedLong::verify(autocorrect);
104     /* perform additional checks on the stored value */
105     Uint32 *uintVals;
106     errorFlag = getUint32Array(uintVals);
107     if (errorFlag.good() && (Length > 0) && (uintVals != NULL) && (*uintVals != 0) && (nextRecord == NULL))
108         errorFlag = EC_CorruptedData;
109     return errorFlag;
110 }
111