本文整理匯總了C++中ROW::get_num_columns方法的典型用法代碼示例。如果您正苦於以下問題:C++ ROW::get_num_columns方法的具體用法?C++ ROW::get_num_columns怎麽用?C++ ROW::get_num_columns使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ROW
的用法示例。
在下文中一共展示了ROW::get_num_columns方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: value_type
void LRURowStorage<ROW, V>::insert_inactive(int32_t row_id,
const ROW<V>& new_row) {
// Sanity check.
int num_rows = inactive_list_.size() + active_list_.size();
CHECK_LE(num_rows, this->capacity_)
<< "Number of rows exceed storage size.";
// If necessary, make space...
if (num_rows == this->capacity_) {
// ...by purging the least-recently-used element (head of list).
VLOG(1) << "Evicting row " << inactive_list_.right.begin()->second
<< " to insert row " << row_id;
inactive_list_.right.erase(inactive_list_.right.begin());
}
// Create a new record from the key and the value
// bimap's list_view defaults to inserting this at
// the list tail (considered most-recently-used).
int threshold_count = static_cast<int>(num_row_access_to_active_ *
new_row.get_num_columns()); // Compute the threshold count.
AccessStatsRow new_inactive_row = boost::tuples::make_tuple(new_row, 0,
threshold_count);
inactive_list_.insert(
typename AccessCountMapList::value_type(row_id, new_inactive_row));
VLOG(1) << "Inserted new row (row id = " << row_id << ") of size "
<< new_row.get_num_columns() << " with threshold count = "
<< threshold_count;
}
示例2: PromoteInactiveRowOrRelocate
int LRURowStorage<ROW, V>::PutRow(int32_t row_id,
const ROW<V>& new_row) {
// Look for row_id in active_list_.
const typename MapList::left_iterator ait = active_list_.left.find(row_id);
if (ait != active_list_.left.end()) {
// We found row_id in active_list_. Update it.
ait->second = new_row;
// Now move it to the end of the list (most recent)
active_list_.right.relocate(
active_list_.right.end(),
active_list_.project_right(ait));
return 0; // replace existing row.
}
// Look for row_id in inactive_list_.
const inactive_list_left_iter_t iit = inactive_list_.left.find(row_id);
if (iit != inactive_list_.left.end()) {
// We found row_id in inactive_list_.
AccessStatsRow& row_tuple = iit->second;
// Update it.
row_tuple.template get<AccessStatsRowTuple::DATA>() = new_row;
row_tuple.template get<AccessStatsRowTuple::CURR_COUNT>() +=
new_row.get_num_columns();
// Recompute the threshold count.
row_tuple.template get<AccessStatsRowTuple::THRESHOLD>() =
static_cast<int>(num_row_access_to_active_ * new_row.get_num_columns());
PromoteInactiveRowOrRelocate(iit);
return 0; // replace existing row.
}
// Not found in either list, put it in inactive_list_.
insert_inactive(row_id, new_row);
return 1; // inserting new row.
}