OpenFPGA/libs/libopenfpgacapnproto/mmap_file.h

21 lines
399 B
C
Raw Normal View History

2024-09-25 05:42:04 -05:00
#ifndef MMAP_FILE_H_
#define MMAP_FILE_H_
#include <string>
2024-09-27 05:41:30 -05:00
2024-09-25 05:42:04 -05:00
#include "capnp/message.h"
#include "kj/array.h"
// Platform independent mmap, useful for reading large capnp's.
class MmapFile {
2024-09-27 05:41:30 -05:00
public:
explicit MmapFile(const std::string& file);
const kj::ArrayPtr<const ::capnp::word> getData() const;
2024-09-25 05:42:04 -05:00
2024-09-27 05:41:30 -05:00
private:
size_t size_;
kj::Array<const kj::byte> data_;
2024-09-25 05:42:04 -05:00
};
#endif /* MMAP_FILE_H_ */