本文整理汇总了C++中Transaction::clear_value方法的典型用法代码示例。如果您正苦于以下问题:C++ Transaction::clear_value方法的具体用法?C++ Transaction::clear_value怎么用?C++ Transaction::clear_value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transaction
的用法示例。
在下文中一共展示了Transaction::clear_value方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
process_unset(vector<string> cmd_str) {
int val;
int prev_tid, prev_val_tid;
int prev_var_val_cnt, prev_var_val;
Transaction* t = trans_stack.back();
t->clear_value(cmd_str[1]);
// if the variable was modified last in another transaction, add this transaction to the
// var_tid_stack
if ( (!var_tid_stack[cmd_str[1]].empty()) && (t->get_tid() != var_tid_stack[cmd_str[1]].back())) {
prev_tid = var_tid_stack[cmd_str[1]].back();
prev_var_val = trans_stack[prev_tid]->get_value(cmd_str[1]);
if (!val_tid_stack[prev_var_val].empty()) {
prev_val_tid = val_tid_stack[prev_var_val].back();
}
prev_var_val_cnt = trans_stack[prev_val_tid]->get_valMap_value(prev_var_val);
var_tid_stack[cmd_str[1]].push_back(t->get_tid());
// we need a new label -9999 to indicate that the variable was unset
// for process_get aka displaying purposes; use it to update current transaction
t->add_value(cmd_str[1], -9999);
//if value of var is 0, then look for previous tid count and add that to the present tid
if (prev_var_val != -1) {
//the prev var value has changed so add current tid to the val_tid_stack
val_tid_stack[prev_var_val].push_back(t->get_tid());
t->set_valMap_value(prev_var_val, --prev_var_val_cnt);
}
}
}