Medial Code Documentation
Loading...
Searching...
No Matches
line_split.h
Go to the documentation of this file.
1
7#ifndef DMLC_IO_LINE_SPLIT_H_
8#define DMLC_IO_LINE_SPLIT_H_
9
10#include <dmlc/io.h>
11#include <vector>
12#include <cstdio>
13#include <string>
14#include <cstring>
15#include "./input_split_base.h"
16
17namespace dmlc {
18namespace io {
21 public:
22 LineSplitter(FileSystem *fs,
23 const char *uri,
24 unsigned rank,
25 unsigned nsplit) {
26 this->Init(fs, uri, 1);
27 this->ResetPartition(rank, nsplit);
28 }
29
30 bool IsTextParser(void) {
31 return true;
32 }
33 virtual bool ExtractNextRecord(Blob *out_rec, Chunk *chunk);
34 protected:
35 virtual size_t SeekRecordBegin(Stream *fi);
36 virtual const char*
37 FindLastRecordBegin(const char *begin, const char *end);
38};
39} // namespace io
40} // namespace dmlc
41#endif // DMLC_IO_LINE_SPLIT_H_
interface of stream I/O for serialization
Definition io.h:30
class to construct input split from multiple files
Definition input_split_base.h:21
void Init(FileSystem *fs, const char *uri, size_t align_bytes, const bool recurse_directories=false)
intialize the base before doing anything
Definition input_split_base.cc:13
virtual void ResetPartition(unsigned rank, unsigned nsplit)
reset the Input split to a certain part id, The InputSplit will be pointed to the head of the new spe...
Definition input_split_base.cc:30
class that split the files by line
Definition line_split.h:20
virtual size_t SeekRecordBegin(Stream *fi)
seek to the beginning of the first record in current file pointer
Definition line_split.cc:9
virtual const char * FindLastRecordBegin(const char *begin, const char *end)
find the last occurance of record header
Definition line_split.cc:27
bool IsTextParser(void)
query whether this object is a text parser
Definition line_split.h:30
virtual bool ExtractNextRecord(Blob *out_rec, Chunk *chunk)
extract next record from the chunk
Definition line_split.cc:36
defines serializable interface of dmlc
base class to construct input split from multiple files
namespace for dmlc
Definition array_view.h:12