SHOGUN
3.2.1
首页
相关页面
模块
类
文件
文件列表
文件成员
全部
类
命名空间
文件
函数
变量
类型定义
枚举
枚举值
友元
宏定义
组
页
src
shogun
io
LineReader.h
浏览该文件的文档.
1
/*
2
* This program is free software; you can redistribute it and/or modify
3
* it under the terms of the GNU General Public License as published by
4
* the Free Software Foundation; either version 3 of the License, or
5
* (at your option) any later version.
6
*
7
* Written (W) 2013 Evgeniy Andreev (gsomix)
8
*/
9
10
#ifndef __LINE_READER_H__
11
#define __LINE_READER_H__
12
13
#include <
shogun/lib/SGVector.h
>
14
#include <
shogun/lib/Tokenizer.h
>
15
#include <
shogun/lib/CircularBuffer.h
>
16
17
namespace
shogun
18
{
20
class
CLineReader
:
public
CSGObject
21
{
22
public
:
24
CLineReader
();
25
31
CLineReader
(FILE* stream,
CTokenizer
* tokenizer);
32
40
CLineReader
(int32_t max_string_length, FILE* stream,
CTokenizer
* tokenizer);
41
43
virtual
~CLineReader
();
44
49
virtual
bool
has_next
();
50
52
virtual
void
skip_line
();
53
55
virtual
SGVector<char>
read_line
();
56
58
void
reset
();
59
64
void
set_tokenizer
(
CTokenizer
* tokenizer);
65
67
virtual
const
char
*
get_name
()
const
{
return
"LineReader"
; }
68
69
private
:
71
void
init();
72
74
int32_t read(int32_t& bytes_to_skip);
75
77
SGVector<char>
read_token(int32_t line_len);
78
79
private
:
81
CCircularBuffer
* m_buffer;
82
84
CTokenizer
* m_tokenizer;
85
87
FILE* m_stream;
88
90
int32_t m_max_token_length;
91
93
int32_t m_next_token_length;
94
};
95
96
}
97
98
#endif
/* __FILE_READER_H__ */
SHOGUN
机器学习工具包 - 项目文档