1234285Sdim//===---- llvm/Support/DataStream.h - Lazy bitcode streaming ----*- C++ -*-===//
2234285Sdim//
3234285Sdim//                     The LLVM Compiler Infrastructure
4234285Sdim//
5234285Sdim// This file is distributed under the University of Illinois Open Source
6234285Sdim// License. See LICENSE.TXT for details.
7234285Sdim//
8234285Sdim//===----------------------------------------------------------------------===//
9234285Sdim//
10234285Sdim// This header defines DataStreamer, which fetches bytes of data from
11234285Sdim// a stream source. It provides support for streaming (lazy reading) of
12234285Sdim// data, e.g. bitcode
13234285Sdim//
14234285Sdim//===----------------------------------------------------------------------===//
15234285Sdim
16234285Sdim
17249423Sdim#ifndef LLVM_SUPPORT_DATASTREAM_H
18249423Sdim#define LLVM_SUPPORT_DATASTREAM_H
19234285Sdim
20234285Sdim#include <string>
21234285Sdim
22234285Sdimnamespace llvm {
23234285Sdim
24234285Sdimclass DataStreamer {
25234285Sdimpublic:
26234285Sdim  /// Fetch bytes [start-end) from the stream, and write them to the
27234285Sdim  /// buffer pointed to by buf. Returns the number of bytes actually written.
28234285Sdim  virtual size_t GetBytes(unsigned char *buf, size_t len) = 0;
29234285Sdim
30234285Sdim  virtual ~DataStreamer();
31234285Sdim};
32234285Sdim
33234285SdimDataStreamer *getDataFileStreamer(const std::string &Filename,
34234285Sdim                                  std::string *Err);
35234285Sdim
36234285Sdim}
37234285Sdim
38234285Sdim#endif  // LLVM_SUPPORT_DATASTREAM_H_
39