OFFIS DCMTK  Version 3.6.0
dcistrma.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: base classes for input streams
19  *
20  * Last Update: $Author: joergr $
21  * Update Date: $Date: 2010-10-14 13:15:41 $
22  * CVS/RCS Revision: $Revision: 1.5 $
23  * Status: $State: Exp $
24  *
25  * CVS/RCS Log at end of file
26  *
27  */
28 
29 #ifndef DCISTRMA_H
30 #define DCISTRMA_H
31 
32 #include "dcmtk/config/osconfig.h"
33 #include "dcmtk/ofstd/oftypes.h" /* for OFBool */
34 #include "dcmtk/ofstd/ofcond.h" /* for OFCondition */
35 #include "dcmtk/ofstd/offile.h" /* for offile_off_t */
36 #include "dcmtk/dcmdata/dcxfer.h" /* for E_StreamCompression */
37 
38 class DcmInputStream;
39 
44 {
45 public:
46 
48  virtual ~DcmProducer()
49  {
50  }
51 
56  virtual OFBool good() const = 0;
57 
62  virtual OFCondition status() const = 0;
63 
67  virtual OFBool eos() = 0;
68 
76  virtual offile_off_t avail() = 0;
77 
83  virtual offile_off_t read(void *buf, offile_off_t buflen) = 0;
84 
89  virtual offile_off_t skip(offile_off_t skiplen) = 0;
90 
95  virtual void putback(offile_off_t num) = 0;
96 
97 };
98 
99 
104 {
105 public:
106 
108  virtual ~DcmInputFilter()
109  {
110  }
111 
118  virtual void append(DcmProducer& producer) = 0;
119 };
120 
121 
126 {
127 public:
128 
131  {
132  }
133 
137  virtual DcmInputStream *create() const = 0;
138 
141  virtual DcmInputStreamFactory *clone() const = 0;
142 };
143 
144 
148 {
149 public:
150 
152  virtual ~DcmInputStream();
153 
158  virtual OFBool good() const;
159 
164  virtual OFCondition status() const;
165 
169  virtual OFBool eos();
170 
178  virtual offile_off_t avail();
179 
185  virtual offile_off_t read(void *buf, offile_off_t buflen);
186 
191  virtual offile_off_t skip(offile_off_t skiplen);
192 
196  virtual offile_off_t tell() const;
197 
205  virtual OFCondition installCompressionFilter(E_StreamCompression filterType);
206 
216  virtual DcmInputStreamFactory *newFactory() const = 0;
217 
225  virtual void mark();
226 
231  virtual void putback();
232 
233 protected:
234 
241  DcmInputStream(DcmProducer *initial);
242 
245  const DcmProducer *currentProducer() const;
246 
247 private:
248 
251 
254 
257 
260 
262  offile_off_t tell_;
263 
265  offile_off_t mark_;
266 };
267 
268 
269 
270 #endif
271 
272 /*
273  * CVS/RCS Log:
274  * $Log: dcistrma.h,v $
275  * Revision 1.5 2010-10-14 13:15:41 joergr
276  * Updated copyright header. Added reference to COPYRIGHT file.
277  *
278  * Revision 1.4 2009-11-04 09:58:07 uli
279  * Switched to logging mechanism provided by the "new" oflog module
280  *
281  * Revision 1.3 2007-02-19 15:45:41 meichel
282  * Class DcmInputStream and related classes are now safe for use with
283  * large files (2 GBytes or more) if supported by compiler and operating system.
284  *
285  * Revision 1.2 2005/12/08 16:28:15 meichel
286  * Changed include path schema for all DCMTK header files
287  *
288  * Revision 1.1 2002/08/27 16:55:32 meichel
289  * Initial release of new DICOM I/O stream classes that add support for stream
290  * compression (deflated little endian explicit VR transfer syntax)
291  *
292  *
293  */
294 
virtual ~DcmInputStream()
destructor
virtual offile_off_t avail()=0
returns the minimum number of bytes that can be read with the next call to read().
virtual void putback(offile_off_t num)=0
resets the stream to the position by the given number of bytes.
DcmInputStream & operator=(const DcmInputStream &)
private unimplemented copy assignment operator
virtual OFCondition status() const
returns the status of the stream as an OFCondition object.
virtual DcmInputStream * create() const =0
create a new input stream object
virtual OFCondition installCompressionFilter(E_StreamCompression filterType)
installs a compression filter for the given stream compression type, which should be neither ESC_none...
virtual offile_off_t skip(offile_off_t skiplen)
skips over the given number of bytes (or less)
virtual ~DcmProducer()
destructor
Definition: dcistrma.h:48
virtual offile_off_t avail()
returns the minimum number of bytes that can be read with the next call to read().
virtual void mark()
marks the current stream position for a later putback operation, overwriting a possibly existing prio...
virtual OFBool eos()=0
returns true if the producer is at the end of stream.
virtual OFBool good() const =0
returns the status of the producer.
DcmProducer * current_
pointer to first node in filter chain
Definition: dcistrma.h:256
virtual offile_off_t tell() const
returns the total number of bytes read from the stream so far
virtual OFBool eos()
returns true if the producer is at the end of stream.
virtual offile_off_t skip(offile_off_t skiplen)=0
skips over the given number of bytes (or less)
pure virtual abstract base class for input filters, i.e.
Definition: dcistrma.h:103
virtual offile_off_t read(void *buf, offile_off_t buflen)=0
reads as many bytes as possible into the given block.
offile_off_t mark_
putback marker
Definition: dcistrma.h:265
const DcmProducer * currentProducer() const
returns pointer to current producer object
virtual ~DcmInputStreamFactory()
destructor
Definition: dcistrma.h:130
virtual OFBool good() const
returns the status of the stream.
virtual void append(DcmProducer &producer)=0
determines the producer from which the filter is supposed to read it's input.
pure virtual abstract base class for input stream factories, i.e.
Definition: dcistrma.h:125
offile_off_t tell_
counter for number of bytes read so far
Definition: dcistrma.h:262
abstract base class for input streams.
Definition: dcistrma.h:147
virtual ~DcmInputFilter()
destructor
Definition: dcistrma.h:108
virtual DcmInputStreamFactory * newFactory() const =0
creates a new factory object for the current stream and stream position.
virtual void putback()
resets the stream to the position previously marked with setPutbackMark().
pure virtual abstract base class for producers, i.e.
Definition: dcistrma.h:43
virtual OFCondition status() const =0
returns the status of the producer as an OFCondition object.
virtual DcmInputStreamFactory * clone() const =0
returns a pointer to a copy of this object
DcmInputStream(DcmProducer *initial)
protected constructor, to be called from derived class constructor
virtual offile_off_t read(void *buf, offile_off_t buflen)
reads as many bytes as possible into the given block.
DcmInputFilter * compressionFilter_
pointer to compression filter, NULL if no compression
Definition: dcistrma.h:259
General purpose class for condition codes.
Definition: ofcond.h:305


Generated on Wed Dec 28 2016 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.8.8