1#ifndef ANDROID_PDX_MESSAGE_READER_H_
2#define ANDROID_PDX_MESSAGE_READER_H_
3
4#include <memory>
5
6#include <pdx/channel_handle.h>
7#include <pdx/file_handle.h>
8
9namespace android {
10namespace pdx {
11
12class InputResourceMapper {
13 public:
14  virtual bool GetFileHandle(FileReference ref, LocalHandle* handle) = 0;
15  virtual bool GetChannelHandle(ChannelReference ref,
16                                LocalChannelHandle* handle) = 0;
17
18 protected:
19  virtual ~InputResourceMapper() = default;
20};
21
22class MessageReader {
23 public:
24  // Pointers to start/end of the region in the read buffer.
25  using BufferSection = std::pair<const void*, const void*>;
26
27  virtual BufferSection GetNextReadBufferSection() = 0;
28  virtual void ConsumeReadBufferSectionData(const void* new_start) = 0;
29  virtual InputResourceMapper* GetInputResourceMapper() = 0;
30
31 protected:
32  virtual ~MessageReader() = default;
33};
34
35}  // namespace pdx
36}  // namespace android
37
38#endif  // ANDROID_PDX_MESSAGE_READER_H_
39