dcmdata/include/dcmtk/dcmdata/dcwcache.h

00001 /*
00002  *
00003  *  Copyright (C) 2007-2010, OFFIS e.V.
00004  *  All rights reserved.  See COPYRIGHT file for details.
00005  *
00006  *  This software and supporting documentation were developed by
00007  *
00008  *    OFFIS e.V.
00009  *    R&D Division Health
00010  *    Escherweg 2
00011  *    D-26121 Oldenburg, Germany
00012  *
00013  *
00014  *  Module:  dcmdata
00015  *
00016  *  Author:  Marco Eichelberg
00017  *
00018  *  Purpose: file cache facility for DcmElement::getPartialValue
00019  *
00020  *  Last Update:      $Author: joergr $
00021  *  Update Date:      $Date: 2010-10-14 13:15:43 $
00022  *  CVS/RCS Revision: $Revision: 1.4 $
00023  *  Status:           $State: Exp $
00024  *
00025  *  CVS/RCS Log at end of file
00026  *
00027  */
00028 
00029 
00030 #ifndef DCWCACHE_H
00031 #define DCWCACHE_H
00032 
00033 #include "dcmtk/config/osconfig.h"    /* make sure OS specific configuration is included first */
00034 
00035 #include "dcmtk/ofstd/oftypes.h"      /* for Uint8 */
00036 #include "dcmtk/dcmdata/dcfcache.h"   /* for class DcmFileCache */
00037 
00038 class DcmElement;
00039 class DcmOutputStream;
00040 
00041 #define DcmWriteCacheBufsize 65536    /* buffer size, in bytes */
00042 
00050 class DcmWriteCache
00051 {
00052 public:
00053 
00055   DcmWriteCache()
00056   : fcache_()
00057   , buf_(NULL)
00058   , owner_(NULL)
00059   , offset_(0)
00060   , numBytes_(0)
00061   , capacity_(0)
00062   , fieldLength_(0)
00063   , fieldOffset_(0)
00064   , byteOrder_(EBO_unknown)
00065   {
00066   }
00067 
00069   ~DcmWriteCache()
00070   {
00071     delete[] buf_;
00072   }
00073 
00080   void init(void *owner, Uint32 fieldLength, Uint32 bytesTransferred, E_ByteOrder byteOrder);
00081 
00085   OFBool bufferIsEmpty() const { return (numBytes_ == 0); }
00086 
00090   Uint32 contentLength() const { return numBytes_; }
00091 
00099   OFCondition fillBuffer(DcmElement& elem);
00100 
00105   Uint32 writeBuffer(DcmOutputStream &outStream);
00106 
00107 private:
00108 
00110   DcmWriteCache(const DcmWriteCache& arg);
00111 
00113   DcmWriteCache& operator=(const DcmWriteCache& arg);
00114 
00116   DcmFileCache fcache_;
00117 
00119   Uint8 *buf_;
00120 
00122   void *owner_;
00123 
00125   Uint32 offset_;
00126 
00128   Uint32 numBytes_;
00129 
00131   Uint32 capacity_;
00132 
00134   Uint32 fieldLength_;
00135 
00137   Uint32 fieldOffset_;
00138 
00140   E_ByteOrder byteOrder_;
00141 };
00142 
00143 #endif
00144 
00145 /*
00146  * CVS/RCS Log:
00147  * $Log: dcwcache.h,v $
00148  * Revision 1.4  2010-10-14 13:15:43  joergr
00149  * Updated copyright header. Added reference to COPYRIGHT file.
00150  *
00151  * Revision 1.3  2009-02-25 12:58:55  joergr
00152  * Removed wrong comment (apparently copied from other class).
00153  *
00154  * Revision 1.2  2009-02-04 17:54:31  joergr
00155  * Fixed various layout and formatting issues.
00156  *
00157  * Revision 1.1  2007-11-29 14:30:18  meichel
00158  * Write methods now handle large raw data elements (such as pixel data)
00159  *   without loading everything into memory. This allows very large images to
00160  *   be sent over a network connection, or to be copied without ever being
00161  *   fully in memory.
00162  *
00163  *
00164  */


Generated on 6 Jan 2011 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.5.1