ClockWork DB CoreAPI
1.0.48
Abstract Time Series and Storage/Management Library
Loading...
Searching...
No Matches
csv_threaded_stream_parser.hpp
1
#ifndef HAVE_TOM__CSV_THREADED_STREAM_PARSER_HPP
2
#define HAVE_TOM__CSV_THREADED_STREAM_PARSER_HPP
3
4
#include <boost/thread/thread.hpp>
5
#include <tom-util/defines.hpp>
6
#include <fstream>
7
#include <tom-util/csv_stream_parser.hpp>
8
#include <tom-util/shared_list.hpp>
9
10
namespace
tom {
11
12
class
TOM_UTIL_API
csv_threaded_stream_parser
:
public
csv_stream_parser
13
{
14
public
:
15
16
csv_threaded_stream_parser
( std::ifstream &stream,
char
delim =
','
,
char
escape =
'\\'
,
char
quote =
'\"'
) :
17
csv_stream_parser
(stream, delim, escape, quote ), m_buffer( ), m_runner(
this
)
18
{ start(); }
19
20
virtual
~csv_threaded_stream_parser
() { }
21
22
// start!
23
void
start();
24
25
virtual
bool
26
nextLine();
27
28
virtual
const_iterator
29
begin()
const
;
30
31
virtual
iterator
32
begin();
33
34
virtual
const_iterator
35
end()
const
;
36
37
virtual
iterator
38
end();
39
40
virtual
size_t
41
size();
42
43
virtual
const
String
&
44
operator[](
int
i );
45
46
protected
:
47
struct
exerciser
;
48
friend
struct
exerciser
;
49
50
shared_list < csv_stream_parser::token_vector > m_buffer;
51
csv_stream_parser::token_vector m_active_line;
52
53
struct
exerciser
54
{
55
exerciser
(
csv_threaded_stream_parser
*parser ) : m_parser(parser){ }
56
void
operator()();
57
csv_threaded_stream_parser
*m_parser;
58
};
59
60
exerciser
m_runner;
61
62
};
63
/*
64
void
65
csv_threaded_stream_parser::start()
66
{
67
68
boost::thread thrd( m_runner );
69
70
//we dont want to join...just let it run...
71
//if they want the data they will get it!
72
//thrd.join();
73
}
74
*/
75
/* This is the thread func that keeps on pumping data
76
* into the buffer...
77
*/
78
/*
79
void
80
csv_threaded_stream_parser::exerciser::operator()()
81
{
82
while ( m_parser->csv_stream_parser::nextLine() )
83
m_parser->m_buffer.push_back( m_parser->csv_stream_parser::m_tokens );
84
85
// indicate we are done writing!
86
m_parser->m_buffer.set_read_only();
87
}
88
*/
89
90
}
// end tom namespace
91
92
#endif
tom::String
Definition
string.hpp:15
tom::csv_stream_parser
Definition
csv_stream_parser.hpp:18
tom::csv_threaded_stream_parser
Definition
csv_threaded_stream_parser.hpp:13
tom::csv_threaded_stream_parser::exerciser
Definition
csv_threaded_stream_parser.hpp:54
tom-util
csv_threaded_stream_parser.hpp
Generated on Wed Oct 8 2025 10:10:36 for ClockWork DB CoreAPI by
1.9.8