VTK  9.3.1
vtkResourceStream.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
3 #ifndef vtkResourceStream_h
4 #define vtkResourceStream_h
5 
6 #include "vtkIOCoreModule.h" // For export macro
7 #include "vtkObject.h"
8 
9 #include <cstdlib> // for std::size_t
10 #include <memory> // for std::unique_ptr
11 
12 VTK_ABI_NAMESPACE_BEGIN
13 
30 class VTKIOCORE_EXPORT vtkResourceStream : public vtkObject
31 {
32  struct vtkInternals;
33 
34 public:
35  enum class SeekDirection
36  {
37  Begin = 0,
38  Current = 1,
39  End = 2
40  };
41 
42  vtkTypeMacro(vtkResourceStream, vtkObject);
43  void PrintSelf(ostream& os, vtkIndent indent) override;
44 
56  virtual std::size_t Read(void* buffer, std::size_t bytes) = 0;
57 
69  virtual bool EndOfStream() = 0;
70 
81  virtual vtkTypeInt64 Seek(vtkTypeInt64 pos, SeekDirection dir);
82 
92  virtual vtkTypeInt64 Tell();
93 
99  bool SupportSeek() const;
100 
101 protected:
110  vtkResourceStream(bool supportSeek);
111  ~vtkResourceStream() override;
112  vtkResourceStream(const vtkResourceStream&) = delete;
113  vtkResourceStream& operator=(const vtkResourceStream&) = delete;
114 
115 private:
116  std::unique_ptr<vtkInternals> Impl;
117 };
118 
119 VTK_ABI_NAMESPACE_END
120 
121 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:51
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
Abstract class used for custom streams.
a simple class to control print indentation
Definition: vtkIndent.h:28