0.9.8.10
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
home
doug
src
hypertable
src
cc
Hypertable
Lib
TableSplit.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.
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_TABLESPLIT_H
23
#define HYPERTABLE_TABLESPLIT_H
24
25
#include "
Common/PageArena.h
"
26
27
#include <vector>
28
29
namespace
Hypertable
{
30
34
struct
TableSplit
{
35
TableSplit
() :
start_row
(0),
end_row
(0),
location
(0),
ip_address
(0),
hostname
(0) { }
36
37
void
clear
() {
38
start_row
= 0;
39
end_row
= 0;
40
location
= 0;
41
ip_address
= 0;
42
hostname
= 0;
43
}
44
45
const
char
*
start_row
;
46
const
char
*
end_row
;
47
const
char
*
location
;
48
const
char
*
ip_address
;
49
const
char
*
hostname
;
50
};
51
52
std::ostream &
operator<<
(std::ostream &os,
const
TableSplit
&ts);
53
54
// Builds a list of table splits (could manage storage)
55
class
TableSplitBuilder
{
56
public
:
57
58
TableSplitBuilder
(
CharArena
&a) :
m_arena
(a) { }
59
60
void
set_start_row
(
const
std::string &row) {
61
m_table_split
.
start_row
=
m_arena
.
dup
(row);
62
}
63
64
void
set_end_row
(
const
std::string &row) {
65
m_table_split
.
end_row
=
m_arena
.
dup
(row);
66
}
67
68
void
set_location
(
const
std::string &loc) {
69
m_table_split
.
location
=
m_arena
.
dup
(loc);
70
}
71
72
void
set_ip_address
(
const
std::string &ip) {
73
m_table_split
.
ip_address
=
m_arena
.
dup
(ip);
74
}
75
76
void
set_hostname
(
const
std::string &h) {
77
m_table_split
.
hostname
=
m_arena
.
dup
(h);
78
}
79
80
void
clear
() {
m_table_split
.
clear
(); }
81
82
TableSplit
&
get
() {
return
m_table_split
; }
83
84
CharArena
&
arena
() {
return
m_arena
; }
85
86
private
:
87
CharArena
&
m_arena
;
88
TableSplit
m_table_split
;
89
};
90
91
class
TableSplitsContainer
:
public
std::vector<TableSplit> {
92
public
:
93
CharArena
&
arena
() {
return
m_arena
; }
94
private
:
95
CharArena
m_arena
;
96
};
97
98
99
100
}
// namespace Hypertable
101
102
#endif // HYPERTABLE_TABLESPLIT_H
Hypertable::TableSplitBuilder::m_arena
CharArena & m_arena
Definition:
TableSplit.h:87
PageArena.h
PageArena memory allocator.
Hypertable::TableSplit
Represents a table split.
Definition:
TableSplit.h:34
Hypertable::TableSplitBuilder::set_ip_address
void set_ip_address(const std::string &ip)
Definition:
TableSplit.h:72
Hypertable::TableSplitBuilder::set_hostname
void set_hostname(const std::string &h)
Definition:
TableSplit.h:76
Hypertable::TableSplit::hostname
const char * hostname
Definition:
TableSplit.h:49
Hypertable::TableSplitsContainer
Definition:
TableSplit.h:91
Hypertable::PageArena::dup
CharT * dup(const CharT *s)
Duplicate a null terminated string; memory is allocated from the pool.
Definition:
PageArena.h:274
Hypertable::TableSplitBuilder::set_location
void set_location(const std::string &loc)
Definition:
TableSplit.h:68
Hypertable::TableSplitBuilder::set_end_row
void set_end_row(const std::string &row)
Definition:
TableSplit.h:64
Hypertable::TableSplit::location
const char * location
Definition:
TableSplit.h:47
Hypertable::TableSplit::ip_address
const char * ip_address
Definition:
TableSplit.h:48
Hypertable::operator<<
std::ostream & operator<<(std::ostream &os, const crontab_entry &entry)
Helper function to write crontab_entry to an ostream.
Definition:
Crontab.cc:301
Hypertable::PageArena
The PageArena allocator is simple and fast, avoiding individual mallocs/frees.
Definition:
PageArena.h:69
Hypertable::TableSplitBuilder::set_start_row
void set_start_row(const std::string &row)
Definition:
TableSplit.h:60
Hypertable::TableSplitBuilder::TableSplitBuilder
TableSplitBuilder(CharArena &a)
Definition:
TableSplit.h:58
Hypertable::TableSplitsContainer::arena
CharArena & arena()
Definition:
TableSplit.h:93
Hypertable
Hypertable definitions
Definition:
ApplicationHandler.h:36
Hypertable::TableSplitBuilder::clear
void clear()
Definition:
TableSplit.h:80
Hypertable::TableSplitBuilder::arena
CharArena & arena()
Definition:
TableSplit.h:84
Hypertable::TableSplitBuilder
Definition:
TableSplit.h:55
Hypertable::TableSplit::start_row
const char * start_row
Definition:
TableSplit.h:45
Hypertable::TableSplit::clear
void clear()
Definition:
TableSplit.h:37
Hypertable::TableSplit::TableSplit
TableSplit()
Definition:
TableSplit.h:35
Hypertable::TableSplit::end_row
const char * end_row
Definition:
TableSplit.h:46
Hypertable::TableSplitBuilder::m_table_split
TableSplit m_table_split
Definition:
TableSplit.h:88
Hypertable::TableSplitsContainer::m_arena
CharArena m_arena
Definition:
TableSplit.h:95
Generated on Tue Dec 22 2015 18:43:13 for Hypertable by
1.8.8