VTK  9.1.0
vtkInputStream.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkInputStream.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
27#ifndef vtkInputStream_h
28#define vtkInputStream_h
29
30#include "vtkIOCoreModule.h" // For export macro
31#include "vtkObject.h"
32
33class VTKIOCORE_EXPORT vtkInputStream : public vtkObject
34{
35public:
36 vtkTypeMacro(vtkInputStream, vtkObject);
38 void PrintSelf(ostream& os, vtkIndent indent) override;
39
41
44 vtkSetMacro(Stream, istream*);
45 vtkGetMacro(Stream, istream*);
47
53 virtual void StartReading();
54
59 virtual int Seek(vtkTypeInt64 offset);
60
65 virtual size_t Read(void* data, size_t length);
66
73 virtual void EndReading();
74
75protected:
77 ~vtkInputStream() override;
78
79 // The real input stream.
80 istream* Stream;
81 size_t ReadStream(char* data, size_t length);
82
83 // The input stream's position when StartReading was called.
84 vtkTypeInt64 StreamStartPosition;
85
86private:
87 vtkInputStream(const vtkInputStream&) = delete;
88 void operator=(const vtkInputStream&) = delete;
89};
90
91#endif
a simple class to control print indentation
Definition: vtkIndent.h:113
Wraps a binary input stream with a VTK interface.
virtual int Seek(vtkTypeInt64 offset)
Seek to the given offset in the input data.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static vtkInputStream * New()
~vtkInputStream() override
virtual void StartReading()
Called after the stream position has been set by the caller, but before any Seek or Read calls.
virtual void EndReading()
Called after all desired calls to Seek and Read have been made.
virtual size_t Read(void *data, size_t length)
Read input data of the given length.
vtkTypeInt64 StreamStartPosition
istream * Stream
size_t ReadStream(char *data, size_t length)
abstract base class for most VTK objects
Definition: vtkObject.h:82