0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
TestSource.h
Go to the documentation of this file.
1 /* -*- c++ -*-
2  * Copyright (C) 2007-2015 Hypertable, Inc.
3  *
4  * This file is part of Hypertable.
5  *
6  * Hypertable is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; version 3 of the
9  * License, or any later version.
10  *
11  * Hypertable is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19  * 02110-1301, USA.
20  */
21 
22 #ifndef HYPERTABLE_TESTSOURCE_H
23 #define HYPERTABLE_TESTSOURCE_H
24 
25 #include <fstream>
26 #include <iostream>
27 #include <string>
28 
29 #include "Common/ByteString.h"
30 #include "Common/DynamicBuffer.h"
31 #include "Hypertable/Lib/Schema.h"
32 
33 
34 namespace Hypertable {
35 
36  class TestSource {
37 
38  public:
39  TestSource(const std::string &fname, Schema *schema)
40  : m_schema(schema), m_fin(fname.c_str()), m_cur_line(0), m_key_buffer(0),
42 
43  bool next(ByteString &key, ByteString &value);
45  int64_t get_min_timestamp() { return m_min_timestamp; }
46 
47  private:
48  bool create_row_delete(const char *row, int64_t timestamp, ByteString &key,
49  ByteString &value);
50  bool
51  create_column_delete(const char *row, const char *column,
52  int64_t timestamp, ByteString &key, ByteString &value);
53  bool
54  create_insert(const char *row, const char *column, int64_t timestamp,
55  const char *value_str, ByteString &key, ByteString &value);
56 
58  std::ifstream m_fin;
59  long m_cur_line;
62  int64_t m_min_timestamp;
63  };
64 
65 }
66 
67 #endif // HYPERTABLE_TESTSOURCE_H
bool create_column_delete(const char *row, const char *column, int64_t timestamp, ByteString &key, ByteString &value)
Definition: TestSource.cc:170
Schema specification.
Definition: Schema.h:52
TestSource(const std::string &fname, Schema *schema)
Definition: TestSource.h:39
int64_t get_min_timestamp()
Definition: TestSource.h:45
A dynamic, resizable and reference counted memory buffer.
Definition: DynamicBuffer.h:42
Declarations for Schema.
A class managing one or more serializable ByteStrings.
Definition: ByteString.h:47
A dynamic, resizable memory buffer.
DynamicBuffer m_key_buffer
Definition: TestSource.h:60
bool create_insert(const char *row, const char *column, int64_t timestamp, const char *value_str, ByteString &key, ByteString &value)
Definition: TestSource.cc:243
bool create_row_delete(const char *row, int64_t timestamp, ByteString &key, ByteString &value)
Definition: TestSource.cc:139
Hypertable definitions
A serializable ByteString.
DynamicBuffer m_value_buffer
Definition: TestSource.h:61
std::ifstream m_fin
Definition: TestSource.h:58
bool next(ByteString &key, ByteString &value)
Definition: TestSource.cc:39