xref: /minix3/external/bsd/llvm/dist/llvm/include/llvm/Support/DataStream.h (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1 //===---- llvm/Support/DataStream.h - Lazy bitcode streaming ----*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This header defines DataStreamer, which fetches bytes of data from
11 // a stream source. It provides support for streaming (lazy reading) of
12 // data, e.g. bitcode
13 //
14 //===----------------------------------------------------------------------===//
15 
16 
17 #ifndef LLVM_SUPPORT_DATASTREAM_H
18 #define LLVM_SUPPORT_DATASTREAM_H
19 
20 #include <string>
21 
22 namespace llvm {
23 
24 class DataStreamer {
25 public:
26   /// Fetch bytes [start-end) from the stream, and write them to the
27   /// buffer pointed to by buf. Returns the number of bytes actually written.
28   virtual size_t GetBytes(unsigned char *buf, size_t len) = 0;
29 
30   virtual ~DataStreamer();
31 };
32 
33 DataStreamer *getDataFileStreamer(const std::string &Filename,
34                                   std::string *Err);
35 
36 }
37 
38 #endif  // LLVM_SUPPORT_DATASTREAM_H_
39