15#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGTABLE_ROW_RANGE_H
16#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGTABLE_ROW_RANGE_H
18#include "google/cloud/bigtable/internal/prefix_range_end.h"
19#include "google/cloud/bigtable/row_key.h"
20#include "google/cloud/bigtable/version.h"
21#include <google/bigtable/v2/data.pb.h>
28GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
30
31
32
33
34
35
36
37
41 : row_range_(std::move(rhs)) {}
55 result.row_range_.set_start_key_closed(std::forward<T>(begin));
63 result.row_range_.set_end_key_closed(std::forward<T>(end));
72 result.row_range_.set_start_key_open(
"");
73 result.row_range_.set_end_key_open(std::string(
"\0", 1));
78 template <
typename T,
typename U>
80 return RightOpen(std::forward<T>(begin), std::forward<U>(end));
86 auto end = internal::PrefixRangeEnd(prefix);
87 return RightOpen(std::forward<T>(prefix), std::move(end));
93 template <
typename T,
typename U>
96 result.row_range_.set_start_key_closed(std::forward<T>(begin));
97 if (!internal::IsEmptyRowKey(end)) {
98 result.row_range_.set_end_key_open(std::forward<U>(end));
104 template <
typename T,
typename U>
107 result.row_range_.set_start_key_open(std::forward<T>(begin));
108 if (!internal::IsEmptyRowKey(end)) {
109 result.row_range_.set_end_key_closed(std::forward<U>(end));
115 template <
typename T,
typename U>
118 result.row_range_.set_start_key_open(std::forward<T>(begin));
119 if (!internal::IsEmptyRowKey(end)) {
120 result.row_range_.set_end_key_open(std::forward<U>(end));
126 template <
typename T,
typename U>
129 result.row_range_.set_start_key_closed(std::forward<T>(begin));
130 if (!internal::IsEmptyRowKey(end)) {
131 result.row_range_.set_end_key_closed(std::forward<U>(end));
138
139
140
141
142
146 template <
typename T>
148 return !BelowStart(key) && !AboveEnd(key);
152
153
154
155
156
157
158
168 return std::move(row_range_);
173 RowRange() =
default;
176 bool BelowStart(RowKeyType
const& key)
const;
179 bool AboveEnd(RowKeyType
const& key)
const;
182 template <
typename T>
183 bool BelowStart(T
const& key)
const {
184 return BelowStart(RowKeyType(key));
188 template <
typename T>
189 bool AboveEnd(T
const& key)
const {
190 return AboveEnd(RowKeyType(key));
193 ::
google::bigtable::v2::RowRange row_range_;
199 return std::rel_ops::operator!=(lhs, rhs);
203std::ostream& operator<<(std::ostream& os,
RowRange const& x);
204GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Define the interfaces to create row key ranges.
Definition: row_range.h:38
RowRange & operator=(RowRange &&)=default
RowRange(RowRange &&)=default
static RowRange Closed(T &&begin, U &&end)
Return a range representing the interval [begin, end].
Definition: row_range.h:127
static RowRange Open(T &&begin, U &&end)
Return a range representing the interval (begin, end).
Definition: row_range.h:116
RowRange(RowRange const &)=default
::google::bigtable::v2::RowRange const & as_proto() const &
Return the filter expression as a protobuf.
Definition: row_range.h:162
static RowRange Range(T &&begin, U &&end)
Return the range representing the interval [begin, end).
Definition: row_range.h:79
static RowRange EndingAt(T &&end)
Return the range ending at end (included), with no lower limit.
Definition: row_range.h:61
::google::bigtable::v2::RowRange && as_proto() &&
Move out the underlying protobuf value.
Definition: row_range.h:167
RowRange & operator=(RowRange const &)=default
RowRange(::google::bigtable::v2::RowRange rhs)
Definition: row_range.h:40
bool IsEmpty() const
Return true if the range is empty.
std::pair< bool, RowRange > Intersect(RowRange const &range) const
Compute the intersection against another RowRange.
static RowRange Empty()
Return an empty range.
Definition: row_range.h:68
static RowRange StartingAt(T &&begin)
Return the range starting at begin (included), with no upper limit.
Definition: row_range.h:53
static RowRange Prefix(T &&prefix)
Return a range that contains all the keys starting with prefix.
Definition: row_range.h:85
static RowRange RightOpen(T &&begin, U &&end)
Return a range representing the interval (begin, end].
Definition: row_range.h:94
static RowRange LeftOpen(T &&begin, U &&end)
Return a range representing the interval (begin, end].
Definition: row_range.h:105
bool Contains(T const &key) const
Return true if key is in the range.
Definition: row_range.h:147
static RowRange InfiniteRange()
Return the infinite range, i.e., a range including all possible keys.
Definition: row_range.h:49
Contains all the Cloud Bigtable C++ client APIs.
Definition: admin_client.h:28
bool operator==(RowRange const &lhs, RowRange const &rhs)
bool operator!=(RowRange const &lhs, RowRange const &rhs)
Definition: row_range.h:198