summaryrefslogtreecommitdiff
path: root/klm/util/stream/line_input.hh
blob: 86db1dd064eaab5af318bf70109ddb0f87e8ea7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#ifndef UTIL_STREAM_LINE_INPUT__
#define UTIL_STREAM_LINE_INPUT__
namespace util {namespace stream {

class ChainPosition;

/* Worker that reads input into blocks, ensuring that blocks contain whole
 * lines.  Assumes that the maximum size of a line is less than the block size
 */
class LineInput {
  public:
    // Takes ownership upon thread execution.
    explicit LineInput(int fd);

    void Run(const ChainPosition &position);

  private:
    int fd_;
};

}} // namespaces
#endif // UTIL_STREAM_LINE_INPUT__