xref: /aosp_15_r20/external/pytorch/caffe2/serialize/read_adapter_interface.h (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1 #pragma once
2 
3 #include <cstddef>
4 #include <cstdint>
5 
6 #include "c10/macros/Macros.h"
7 
8 namespace caffe2 {
9 namespace serialize {
10 
11 // this is the interface for the (file/stream/memory) reader in
12 // PyTorchStreamReader. with this interface, we can extend the support
13 // besides standard istream
14 class TORCH_API ReadAdapterInterface {
15  public:
16   virtual size_t size() const = 0;
17   virtual size_t read(uint64_t pos, void* buf, size_t n, const char* what = "")
18       const = 0;
19   virtual ~ReadAdapterInterface();
20 };
21 
22 } // namespace serialize
23 } // namespace caffe2
24