read_adapter_interface.h 556 B

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