15#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGTABLE_CELL_H
16#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGTABLE_CELL_H
18#include "google/cloud/bigtable/internal/google_bytes_traits.h"
19#include "google/cloud/bigtable/row_key.h"
20#include "google/cloud/bigtable/version.h"
21#include "google/cloud/status_or.h"
30GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54using ColumnQualifierType = std::decay<
55 decltype(std::declval<
google::bigtable::v2::Column>().qualifier())>::type;
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76using CellValueType = std::decay<
77 decltype(std::declval<
google::bigtable::v2::Cell>().value())>::type;
80
81
82
83
84
85
86
87
88
89
93
94
95
96
97
98
99 template <
typename KeyType,
typename ColumnType,
typename ValueType,
101 typename std::enable_if<!std::is_integral<ValueType>::value,
105 Cell(KeyType&& row_key, std::string family_name,
106 ColumnType&& column_qualifier, std::int64_t timestamp, ValueType&& value,
107 std::vector<std::string> labels)
108 : row_key_(std::forward<KeyType>(row_key)),
109 family_name_(std::move(family_name)),
110 column_qualifier_(std::forward<ColumnType>(column_qualifier)),
111 timestamp_(timestamp),
112 value_(std::forward<ValueType>(value)),
113 labels_(std::move(labels)) {}
116 template <
typename KeyType,
typename ColumnType>
117 Cell(KeyType&& row_key, std::string family_name,
118 ColumnType&& column_qualifier, std::int64_t timestamp,
119 std::int64_t value, std::vector<std::string> labels)
120 :
Cell(std::forward<KeyType>(row_key), std::move(family_name),
121 std::forward<ColumnType>(column_qualifier), timestamp,
123 std::move(labels)) {}
126 template <
typename KeyType,
typename ColumnType,
typename ValueType>
127 Cell(KeyType&& row_key, std::string family_name,
128 ColumnType&& column_qualifier, std::int64_t timestamp, ValueType&& value)
129 :
Cell(std::forward<KeyType>(row_key), std::move(family_name),
130 std::forward<ColumnType>(column_qualifier), timestamp,
131 std::forward<ValueType>(value), std::vector<std::string>{}) {}
135 RowKeyType
const&
row_key()
const {
return row_key_; }
139 std::string
const&
family_name()
const {
return family_name_; }
144 return column_qualifier_;
148 std::chrono::microseconds
timestamp()
const {
149 return std::chrono::microseconds(timestamp_);
154 CellValueType
const&
value()
const& {
return value_; }
156 CellValueType&&
value() && {
return std::move(value_); }
159
160
161
162
163
164
165
166 template <
typename T>
168 return internal::DecodeBigEndianCellValue<T>(value_);
172 std::vector<std::string>
const&
labels()
const {
return labels_; }
176 std::string family_name_;
177 ColumnQualifierType column_qualifier_;
178 std::int64_t timestamp_;
179 CellValueType value_;
180 std::vector<std::string> labels_;
185GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
The in-memory representation of a Bigtable cell.
Definition: cell.h:90
CellValueType const & value() const &
Return the contents of this cell.
Definition: cell.h:154
RowKeyType const & row_key() const
Return the row key this cell belongs to.
Definition: cell.h:135
StatusOr< T > decode_big_endian_integer() const
Interpret the value as a big-endian encoded T and return it.
Definition: cell.h:167
Cell(KeyType &&row_key, std::string family_name, ColumnType &&column_qualifier, std::int64_t timestamp, ValueType &&value)
Create a cell and fill it with data, but with empty labels.
Definition: cell.h:127
std::vector< std::string > const & labels() const
Return the labels applied to this cell by label transformer read filters.
Definition: cell.h:172
std::string const & family_name() const
Return the family this cell belongs to.
Definition: cell.h:139
Cell(KeyType &&row_key, std::string family_name, ColumnType &&column_qualifier, std::int64_t timestamp, std::int64_t value, std::vector< std::string > labels)
Create a Cell and fill it with a 64-bit value encoded as big endian.
Definition: cell.h:117
CellValueType && value() &&
Return the contents of this cell.
Definition: cell.h:156
Cell(KeyType &&row_key, std::string family_name, ColumnType &&column_qualifier, std::int64_t timestamp, ValueType &&value, std::vector< std::string > labels)
Creates a Cell and fill it with data.
Definition: cell.h:105
ColumnQualifierType const & column_qualifier() const
Return the column this cell belongs to.
Definition: cell.h:143
std::chrono::microseconds timestamp() const
Return the timestamp of this cell.
Definition: cell.h:148
Contains all the Cloud Bigtable C++ client APIs.
Definition: admin_client.h:28
Mutation SetCell(Cell)
Create a mutation to set a cell value based on a bigtable::Cell.
Represent a single change to a specific row in a Table.
Definition: mutations.h:45