OFFIS DCMTK  Version 3.6.0
dcistrmf.h
1 /*
2  *
3  * Copyright (C) 1994-2010, OFFIS e.V.
4  * All rights reserved. See COPYRIGHT file for details.
5  *
6  * This software and supporting documentation were developed by
7  *
8  * OFFIS e.V.
9  * R&D Division Health
10  * Escherweg 2
11  * D-26121 Oldenburg, Germany
12  *
13  *
14  * Module: dcmdata
15  *
16  * Author: Marco Eichelberg
17  *
18  * Purpose: DcmInputFileStream and related classes,
19  * implements streamed input from files.
20  *
21  * Last Update: $Author: joergr $
22  * Update Date: $Date: 2010-10-14 13:15:41 $
23  * CVS/RCS Revision: $Revision: 1.9 $
24  * Status: $State: Exp $
25  *
26  * CVS/RCS Log at end of file
27  *
28  */
29 
30 #ifndef DCISTRMF_H
31 #define DCISTRMF_H
32 
33 #include "dcmtk/config/osconfig.h"
34 #include "dcmtk/dcmdata/dcistrma.h"
35 
36 
40 {
41 public:
46  DcmFileProducer(const char *filename, offile_off_t offset = 0);
47 
49  virtual ~DcmFileProducer();
50 
55  virtual OFBool good() const;
56 
61  virtual OFCondition status() const;
62 
66  virtual OFBool eos();
67 
75  virtual offile_off_t avail();
76 
82  virtual offile_off_t read(void *buf, offile_off_t buflen);
83 
88  virtual offile_off_t skip(offile_off_t skiplen);
89 
94  virtual void putback(offile_off_t num);
95 
96 private:
97 
100 
103 
106 
109 
111  offile_off_t size_;
112 };
113 
114 
118 {
119 public:
120 
125  DcmInputFileStreamFactory(const char *filename, offile_off_t offset);
126 
129 
131  virtual ~DcmInputFileStreamFactory();
132 
136  virtual DcmInputStream *create() const;
137 
140  virtual DcmInputStreamFactory *clone() const
141  {
142  return new DcmInputFileStreamFactory(*this);
143  }
144 
145 private:
146 
147 
150 
153 
155  offile_off_t offset_;
156 
157 };
158 
159 
163 {
164 public:
169  DcmInputFileStream(const char *filename, offile_off_t offset = 0);
170 
172  virtual ~DcmInputFileStream();
173 
183  virtual DcmInputStreamFactory *newFactory() const;
184 
185 private:
186 
189 
192 
195 
198 };
199 
206 {
207 public:
208 
215  static DcmTempFileHandler *newInstance(const char *fname);
216 
222  DcmInputStream *create() const;
223 
225  void increaseRefCount();
226 
230  void decreaseRefCount();
231 
232 private:
233 
238  DcmTempFileHandler(const char *fname);
239 
243  virtual ~DcmTempFileHandler();
244 
247 
250 
254  size_t refCount_;
255 
256 #ifdef WITH_THREADS
257  OFMutex mutex_;
259 #endif
260 
263 
264 };
265 
269 {
270 public:
271 
277 
280 
283 
287  virtual DcmInputStream *create() const;
288 
291  virtual DcmInputStreamFactory *clone() const;
292 
293 private:
294 
297 
300 
301 };
302 
303 
304 #endif
305 
306 /*
307  * CVS/RCS Log:
308  * $Log: dcistrmf.h,v $
309  * Revision 1.9 2010-10-14 13:15:41 joergr
310  * Updated copyright header. Added reference to COPYRIGHT file.
311  *
312  * Revision 1.8 2010-10-04 14:44:39 joergr
313  * Replaced "#ifdef _REENTRANT" by "#ifdef WITH_THREADS" where appropriate (i.e.
314  * in all cases where OFMutex, OFReadWriteLock, etc. are used).
315  *
316  * Revision 1.7 2010-03-01 09:08:44 uli
317  * Removed some unnecessary include directives in the headers.
318  *
319  * Revision 1.6 2009-11-04 09:58:07 uli
320  * Switched to logging mechanism provided by the "new" oflog module
321  *
322  * Revision 1.5 2008-05-29 10:39:43 meichel
323  * Implemented new classes DcmTempFileHandler and DcmInputTempFileStreamFactory
324  * that perform thread-safe reference counted life cycle management of a
325  * temporary file and are needed for DcmElement temporary file extensions to come.
326  *
327  * Revision 1.4 2007/02/19 15:45:41 meichel
328  * Class DcmInputStream and related classes are now safe for use with
329  * large files (2 GBytes or more) if supported by compiler and operating system.
330  *
331  * Revision 1.3 2005/12/08 16:28:17 meichel
332  * Changed include path schema for all DCMTK header files
333  *
334  * Revision 1.2 2002/11/27 12:07:21 meichel
335  * Adapted module dcmdata to use of new header file ofstdinc.h
336  *
337  * Revision 1.1 2002/08/27 16:55:33 meichel
338  * Initial release of new DICOM I/O stream classes that add support for stream
339  * compression (deflated little endian explicit VR transfer syntax)
340  *
341  *
342  */
this class provides a simple C++ encapsulation layer for stdio FILE pointers.
Definition: offile.h:115
DcmInputStream * create() const
create an input stream that permits reading from the temporary file
DcmInputTempFileStreamFactory & operator=(const DcmInputTempFileStreamFactory &)
private unimplemented copy assignment operator
OFString filename_
filename
Definition: dcistrmf.h:197
void increaseRefCount()
increase reference counter for this object
DcmInputFileStream & operator=(const DcmInputFileStream &)
private unimplemented copy assignment operator
virtual ~DcmFileProducer()
destructor
virtual OFBool eos()
returns true if the producer is at the end of stream.
virtual OFBool good() const
returns the status of the producer.
input stream factory for temporary file handlers
Definition: dcistrmf.h:268
virtual offile_off_t read(void *buf, offile_off_t buflen)
reads as many bytes as possible into the given block.
DcmInputFileStreamFactory(const char *filename, offile_off_t offset)
constructor
class that manages the life cycle of a temporary file.
Definition: dcistrmf.h:205
DcmInputTempFileStreamFactory(DcmTempFileHandler *handler)
constructor
virtual void putback(offile_off_t num)
resets the stream to the position by the given number of bytes.
DcmTempFileHandler(const char *fname)
private constructor.
virtual offile_off_t avail()
returns the minimum number of bytes that can be read with the next call to read().
virtual DcmInputStreamFactory * newFactory() const
creates a new factory object for the current stream and stream position.
DcmInputFileStreamFactory & operator=(const DcmInputFileStreamFactory &)
private unimplemented copy assignment operator
DcmFileProducer(const char *filename, offile_off_t offset=0)
constructor
OFString filename_
filename
Definition: dcistrmf.h:152
DcmTempFileHandler & operator=(const DcmTempFileHandler &arg)
private undefined copy assignment operator
provides an operating system independent abstraction for mutexes (mutual exclusion locks)...
Definition: ofthread.h:352
virtual DcmInputStream * create() const
create a new input stream object
virtual ~DcmTempFileHandler()
private destructor.
size_t refCount_
number of references to temporary file.
Definition: dcistrmf.h:254
static DcmTempFileHandler * newInstance(const char *fname)
static method that permits creation of instances of this class (only) on the heap, never on the stack.
DcmInputFileStream(const char *filename, offile_off_t offset=0)
constructor
DcmTempFileHandler * fileHandler_
handler for temporary file
Definition: dcistrmf.h:299
OFString filename_
path to temporary file
Definition: dcistrmf.h:262
virtual DcmInputStreamFactory * clone() const
returns a pointer to a copy of this object
Definition: dcistrmf.h:140
DcmFileProducer & operator=(const DcmFileProducer &)
private unimplemented copy assignment operator
OFFile file_
the file we're actually reading from
Definition: dcistrmf.h:105
offile_off_t size_
number of bytes in file
Definition: dcistrmf.h:111
input stream factory for plain files
Definition: dcistrmf.h:117
pure virtual abstract base class for input stream factories, i.e.
Definition: dcistrma.h:125
virtual ~DcmInputTempFileStreamFactory()
destructor, decreases reference counter of temporary file handler
offile_off_t offset_
offset in file
Definition: dcistrmf.h:155
producer class that reads data from a plain file.
Definition: dcistrmf.h:39
virtual DcmInputStreamFactory * clone() const
returns a pointer to a copy of this object
abstract base class for input streams.
Definition: dcistrma.h:147
a simple string class that implements a subset of std::string.
Definition: ofstring.h:86
virtual ~DcmInputFileStream()
destructor
virtual offile_off_t skip(offile_off_t skiplen)
skips over the given number of bytes (or less)
pure virtual abstract base class for producers, i.e.
Definition: dcistrma.h:43
virtual DcmInputStream * create() const
create a new input stream object
DcmFileProducer producer_
the final producer of the filter chain
Definition: dcistrmf.h:194
void decreaseRefCount()
decreases reference counter for this object and deletes the temporary file and this object if the ref...
OFCondition status_
status
Definition: dcistrmf.h:108
virtual ~DcmInputFileStreamFactory()
destructor
input stream that reads from a plain file
Definition: dcistrmf.h:162
virtual OFCondition status() const
returns the status of the producer as an OFCondition object.
General purpose class for condition codes.
Definition: ofcond.h:305


Generated on Wed Jan 4 2017 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.8.6