Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | Related Pages

dcsequen.h

00001 /*
00002  *
00003  *  Copyright (C) 1994-2003, OFFIS
00004  *
00005  *  This software and supporting documentation were developed by
00006  *
00007  *    Kuratorium OFFIS e.V.
00008  *    Healthcare Information and Communication Systems
00009  *    Escherweg 2
00010  *    D-26121 Oldenburg, Germany
00011  *
00012  *  THIS SOFTWARE IS MADE AVAILABLE,  AS IS,  AND OFFIS MAKES NO  WARRANTY
00013  *  REGARDING  THE  SOFTWARE,  ITS  PERFORMANCE,  ITS  MERCHANTABILITY  OR
00014  *  FITNESS FOR ANY PARTICULAR USE, FREEDOM FROM ANY COMPUTER DISEASES  OR
00015  *  ITS CONFORMITY TO ANY SPECIFICATION. THE ENTIRE RISK AS TO QUALITY AND
00016  *  PERFORMANCE OF THE SOFTWARE IS WITH THE USER.
00017  *
00018  *  Module:  dcmdata
00019  *
00020  *  Author:  Gerd Ehlers, Andreas Barth
00021  *
00022  *  Purpose: Interface of class DcmSequenceOfItems
00023  *
00024  *  Last Update:      $Author: joergr $
00025  *  Update Date:      $Date: 2003/08/08 13:29:13 $
00026  *  Source File:      $Source: /share/dicom/cvs-depot/dcmtk/dcmdata/include/dcsequen.h,v $
00027  *  CVS/RCS Revision: $Revision: 1.29 $
00028  *  Status:           $State: Exp $
00029  *
00030  *  CVS/RCS Log at end of file
00031  *
00032  */
00033 
00034 #ifndef DCSEQUEN_H
00035 #define DCSEQUEN_H
00036 
00037 #include "osconfig.h"    /* make sure OS specific configuration is included first */
00038 
00039 #include "ofconsol.h"
00040 #include "dcerror.h"
00041 #include "dctypes.h"
00042 #include "dcobject.h"
00043 #include "dcitem.h"
00044 #include "dctag.h"
00045 #include "dclist.h"
00046 #include "dcstack.h"
00047 
00048 
00049 //
00050 // CLASS DcmSequenceOfItems
00051 // A sequence has no explicit value. Therefore, it should be derived from
00052 // DcmObject. Since a sequence is created in an (pseudo)-item and items collect
00053 // sequences of elements the sequence Tag is derived from element.
00054 
00055 class DcmSequenceOfItems : public DcmElement
00056 {
00057 protected:
00058     DcmList *itemList;
00059     OFBool lastItemComplete;
00060     Uint32 fStartPosition;
00061 
00062     virtual OFCondition readTagAndLength(DcmInputStream &inStream,            // inout
00063                                          const E_TransferSyntax xfer,         // in
00064                                          DcmTag &tag,                         // out
00065                                          Uint32 &length);                     // out
00066 
00067     virtual OFCondition makeSubObject(DcmObject *&subObject,
00068                                       const DcmTag &mewTag,
00069                                       const Uint32 newLength);
00070 
00071     OFCondition readSubItem(DcmInputStream &inStream,                         // inout
00072                             const DcmTag &newTag,                             // in
00073                             const Uint32 newLength,                           // in
00074                             const E_TransferSyntax xfer,                      // in
00075                             const E_GrpLenEncoding glenc,                     // in
00076                             const Uint32 maxReadLength = DCM_MaxReadLength);  // in
00077 
00078     virtual OFCondition searchSubFromHere(const DcmTagKey &tag,               // in
00079                                           DcmStack &resultStack,              // inout
00080                                           const OFBool searchIntoSub);        // in
00081 
00082 
00083 public:
00084     DcmSequenceOfItems(const DcmTag &tag, const Uint32 len = 0);
00085     DcmSequenceOfItems(const DcmSequenceOfItems& oldSeq);
00086     virtual ~DcmSequenceOfItems();
00087 
00088     DcmSequenceOfItems &operator=(const DcmSequenceOfItems &obj);
00089 
00090     virtual DcmEVR ident() const { return EVR_SQ; }
00091     virtual OFBool isLeaf() const { return OFFalse; }
00092 
00093     virtual void print(ostream &out,
00094                        const size_t flags = 0,
00095                        const int level = 0,
00096                        const char *pixelFileName = NULL,
00097                        size_t *pixelCounter = NULL);
00098 
00099     virtual unsigned long getVM() { return 1L; }
00100 
00101     virtual OFCondition computeGroupLengthAndPadding
00102                             (const E_GrpLenEncoding glenc,
00103                              const E_PaddingEncoding padenc = EPD_noChange,
00104                              const E_TransferSyntax xfer = EXS_Unknown,
00105                              const E_EncodingType enctype = EET_ExplicitLength,
00106                              const Uint32 padlen = 0,
00107                              const Uint32 subPadlen = 0,
00108                              Uint32 instanceLength = 0);
00109 
00110     virtual Uint32 calcElementLength(const E_TransferSyntax xfer,
00111                                      const E_EncodingType enctype);
00112 
00113     virtual Uint32 getLength(const E_TransferSyntax xfer = EXS_LittleEndianImplicit,
00114                              const E_EncodingType enctype = EET_UndefinedLength);
00115 
00116     virtual void transferInit();
00117     virtual void transferEnd();
00118 
00119     virtual OFBool canWriteXfer(const E_TransferSyntax oldXfer,
00120                                 const E_TransferSyntax newXfer);
00121 
00122     virtual OFCondition read(DcmInputStream &inStream,
00123                              const E_TransferSyntax xfer,
00124                              const E_GrpLenEncoding glenc = EGL_noChange,
00125                              const Uint32 maxReadLength = DCM_MaxReadLength);
00126 
00127     virtual OFCondition write(DcmOutputStream &outStream,
00128                               const E_TransferSyntax oxfer,
00129                               const E_EncodingType enctype = EET_UndefinedLength);
00130 
00136     virtual OFCondition writeXML(ostream &out,
00137                                  const size_t flags = 0);
00138 
00141     virtual OFCondition writeSignatureFormat(DcmOutputStream &outStream,
00142                                              const E_TransferSyntax oxfer,
00143                                              const E_EncodingType enctype = EET_UndefinedLength);
00144 
00148     virtual OFBool isSignable() const;
00149 
00153     virtual OFBool containsUnknownVR() const;
00154 
00155     virtual unsigned long card();
00156 
00157     virtual OFCondition prepend(DcmItem *item);
00158     virtual OFCondition insert(DcmItem *item,
00159                                unsigned long where = DCM_EndOfListIndex,
00160                                OFBool before = OFFalse);
00161     virtual OFCondition append(DcmItem *item);
00162 
00170     virtual OFCondition insertAtCurrentPos(DcmItem *item,
00171                                            OFBool before = OFFalse);
00172 
00173     virtual DcmItem *getItem(const unsigned long num);
00174     virtual OFCondition nextObject(DcmStack &stack, const OFBool intoSub);
00175     virtual DcmObject *nextInContainer(const DcmObject *obj);
00176     virtual DcmItem *remove(const unsigned long num);
00177     virtual DcmItem *remove(DcmItem *item);
00178     virtual OFCondition clear();
00179     virtual OFCondition verify(const OFBool autocorrect = OFFalse);
00180     virtual OFCondition search(const DcmTagKey &xtag,             // in
00181                                DcmStack &resultStack,             // inout
00182                                E_SearchMode mode = ESM_fromHere,  // in
00183                                OFBool searchIntoSub = OFTrue);    // in
00184     virtual OFCondition searchErrors(DcmStack &resultStack);      // inout
00185     virtual OFCondition loadAllDataIntoMemory(void);
00186 
00187 private:
00188 
00189   /* static helper method used in writeSignatureFormat().
00190    * This function resembles DcmObject::writeTagAndLength()
00191    * but only writes the tag, VR and reserved field.
00192    * @param outStream stream to write to
00193    * @param tag attribute tag
00194    * @param vr attribute VR as reported by getVR
00195    * @param oxfer output transfer syntax
00196    * @return EC_Normal if successful, an error code otherwise
00197    */
00198   static OFCondition writeTagAndVR(DcmOutputStream &outStream,
00199                                    const DcmTag &tag,
00200                                    DcmEVR vr,
00201                                    const E_TransferSyntax oxfer);
00202 };
00203 
00204 
00205 #endif // DCSEQUEN_H
00206 
00207 
00208 /*
00209 ** CVS/RCS Log:
00210 ** $Log: dcsequen.h,v $
00211 ** Revision 1.29  2003/08/08 13:29:13  joergr
00212 ** Added new method insertAtCurrentPos() which allows for a much more efficient
00213 ** insertion (avoids re-searching for the correct position).
00214 **
00215 ** Revision 1.28  2002/12/06 12:49:13  joergr
00216 ** Enhanced "print()" function by re-working the implementation and replacing
00217 ** the boolean "showFullData" parameter by a more general integer flag.
00218 ** Added doc++ documentation.
00219 ** Made source code formatting more consistent with other modules/files.
00220 **
00221 ** Revision 1.27  2002/08/27 16:55:39  meichel
00222 ** Initial release of new DICOM I/O stream classes that add support for stream
00223 **   compression (deflated little endian explicit VR transfer syntax)
00224 **
00225 ** Revision 1.26  2002/04/25 09:43:56  joergr
00226 ** Added support for XML output of DICOM objects.
00227 **
00228 ** Revision 1.25  2001/11/19 15:23:10  meichel
00229 ** Cleaned up signature code to avoid some gcc warnings.
00230 **
00231 ** Revision 1.24  2001/11/16 15:54:39  meichel
00232 ** Adapted digital signature code to final text of supplement 41.
00233 **
00234 ** Revision 1.23  2001/09/25 17:19:28  meichel
00235 ** Adapted dcmdata to class OFCondition
00236 **
00237 ** Revision 1.22  2001/06/01 15:48:43  meichel
00238 ** Updated copyright header
00239 **
00240 ** Revision 1.21  2000/11/07 16:56:09  meichel
00241 ** Initial release of dcmsign module for DICOM Digital Signatures
00242 **
00243 ** Revision 1.20  2000/04/14 15:31:33  meichel
00244 ** Removed default value from output stream passed to print() method.
00245 **   Required for use in multi-thread environments.
00246 **
00247 ** Revision 1.19  2000/03/08 16:26:17  meichel
00248 ** Updated copyright header.
00249 **
00250 ** Revision 1.18  2000/03/03 14:05:25  meichel
00251 ** Implemented library support for redirecting error messages into memory
00252 **   instead of printing them to stdout/stderr for GUI applications.
00253 **
00254 ** Revision 1.17  2000/02/10 10:50:53  joergr
00255 ** Added new feature to dcmdump (enhanced print method of dcmdata): write
00256 ** pixel data/item value fields to raw files.
00257 **
00258 ** Revision 1.16  1999/03/31 09:24:46  meichel
00259 ** Updated copyright header in module dcmdata
00260 **
00261 ** Revision 1.15  1998/11/12 16:47:44  meichel
00262 ** Implemented operator= for all classes derived from DcmObject.
00263 **
00264 ** Revision 1.14  1998/07/15 15:48:52  joergr
00265 ** Removed several compiler warnings reported by gcc 2.8.1 with
00266 ** additional options, e.g. missing copy constructors and assignment
00267 ** operators, initialization of member variables in the body of a
00268 ** constructor instead of the member initialization list, hiding of
00269 ** methods by use of identical names, uninitialized member variables,
00270 ** missing const declaration of char pointers. Replaced tabs by spaces.
00271 **
00272 ** Revision 1.13  1997/07/21 08:25:10  andreas
00273 ** - Replace all boolean types (BOOLEAN, CTNBOOLEAN, DICOM_BOOL, BOOL)
00274 **   with one unique boolean type OFBool.
00275 **
00276 ** Revision 1.12  1997/07/07 07:42:05  andreas
00277 ** - Changed parameter type DcmTag & to DcmTagKey & in all search functions
00278 **   in DcmItem, DcmSequenceOfItems, DcmDirectoryRecord and DcmObject
00279 **
00280 ** Revision 1.11  1997/05/27 13:48:29  andreas
00281 ** - Add method canWriteXfer to class DcmObject and all derived classes.
00282 **   This method checks whether it is possible to convert the original
00283 **   transfer syntax to an new transfer syntax. The check is used in the
00284 **   dcmconv utility to prohibit the change of a compressed transfer
00285 **   syntax to a uncompressed.
00286 **
00287 ** Revision 1.10  1997/05/16 08:23:48  andreas
00288 ** - Revised handling of GroupLength elements and support of
00289 **   DataSetTrailingPadding elements. The enumeratio E_GrpLenEncoding
00290 **   got additional enumeration values (for a description see dctypes.h).
00291 **   addGroupLength and removeGroupLength methods are replaced by
00292 **   computeGroupLengthAndPadding. To support Padding, the parameters of
00293 **   element and sequence write functions changed.
00294 ** - Added a new method calcElementLength to calculate the length of an
00295 **   element, item or sequence. For elements it returns the length of
00296 **   tag, length field, vr field, and value length, for item and
00297 **   sequences it returns the length of the whole item. sequence including
00298 **   the Delimitation tag (if appropriate).  It can never return
00299 **   UndefinedLength.
00300 **
00301 ** Revision 1.9  1997/04/24 12:09:02  hewett
00302 ** Fixed DICOMDIR generation bug affecting ordering of
00303 ** patient/study/series/image records (item insertion into a sequence
00304 ** did produce the expected ordering).
00305 **
00306 ** Revision 1.8  1996/08/05 08:45:28  andreas
00307 ** new print routine with additional parameters:
00308 **         - print into files
00309 **         - fix output length for elements
00310 ** corrected error in search routine with parameter ESM_fromStackTop
00311 **
00312 ** Revision 1.7  1996/07/17 12:38:59  andreas
00313 ** new nextObject to iterate a DicomDataset, DicomFileFormat, Item, ...
00314 **
00315 ** Revision 1.6  1996/01/29 13:38:14  andreas
00316 ** - new put method for every VR to put value as a string
00317 ** - better and unique print methods
00318 **
00319 ** Revision 1.5  1996/01/24 09:34:56  andreas
00320 ** Support for 64 bit long
00321 **
00322 ** Revision 1.4  1996/01/09 11:06:16  andreas
00323 ** New Support for Visual C++
00324 ** Correct problems with inconsistent const declarations
00325 **
00326 ** Revision 1.3  1996/01/05 13:22:59  andreas
00327 ** - changed to support new streaming facilities
00328 ** - more cleanups
00329 ** - merged read / write methods for block and file transfer
00330 **
00331 */


Generated on 29 Apr 2005 for OFFIS DCMTK Version 3.5.3 by Doxygen 1.4.2