VTK  9.3.20240420
vtkInputStream.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
15#ifndef vtkInputStream_h
16#define vtkInputStream_h
17
18#include "vtkIOCoreModule.h" // For export macro
19#include "vtkObject.h"
20
21VTK_ABI_NAMESPACE_BEGIN
22class VTKIOCORE_EXPORT vtkInputStream : public vtkObject
23{
24public:
25 vtkTypeMacro(vtkInputStream, vtkObject);
27 void PrintSelf(ostream& os, vtkIndent indent) override;
28
30
33 vtkSetMacro(Stream, istream*);
34 vtkGetMacro(Stream, istream*);
36
42 virtual void StartReading();
43
48 virtual int Seek(vtkTypeInt64 offset);
49
54 virtual size_t Read(void* data, size_t length);
55
62 virtual void EndReading();
63
64protected:
66 ~vtkInputStream() override;
67
68 // The real input stream.
69 istream* Stream;
70 size_t ReadStream(char* data, size_t length);
71
72 // The input stream's position when StartReading was called.
73 vtkTypeInt64 StreamStartPosition;
74
75private:
76 vtkInputStream(const vtkInputStream&) = delete;
77 void operator=(const vtkInputStream&) = delete;
78};
79
80VTK_ABI_NAMESPACE_END
81#endif
a simple class to control print indentation
Definition vtkIndent.h:108
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
size_t ReadStream(char *data, size_t length)
abstract base class for most VTK objects
Definition vtkObject.h:162