in cpp/src/reader/qds_with_timegenerator.cc [191:252]
int64_t Node::get_cur_timestamp() {
#ifdef DEBUG_SE
DG dg(depth);
#endif
if (type_ == AND_NODE) {
while (true) {
int64_t lt = left_->get_cur_timestamp();
int64_t rt = right_->get_cur_timestamp();
#if DEBUG_SE
std::cout << dg.get_indent()
<< "Node::get_cur_timestamp: AND_NODE, lt=" << lt
<< ", rt=" << rt << std::endl;
#endif
if (lt == INVALID_NEXT_TIMESTAMP || rt == INVALID_NEXT_TIMESTAMP) {
return INVALID_NEXT_TIMESTAMP;
} else if (lt == rt) {
return lt;
} else if (lt < rt) {
left_->next_timestamp(rt - 1);
} else {
right_->next_timestamp(lt - 1);
}
}
} else if (type_ == OR_NODE) {
while (true) {
int64_t lt = left_->get_cur_timestamp();
int64_t rt = right_->get_cur_timestamp();
#if DEBUG_SE
std::cout << dg.get_indent()
<< "Node::get_cur_timestamp: OR_NODE, lt=" << lt
<< ", rt=" << rt << std::endl;
#endif
if (lt == INVALID_NEXT_TIMESTAMP && rt == INVALID_NEXT_TIMESTAMP) {
next_direction_ = STOP_NEXT;
return INVALID_NEXT_TIMESTAMP;
} else if (lt == INVALID_NEXT_TIMESTAMP) {
next_direction_ = RIGHT_NEXT;
return rt;
} else if (rt == INVALID_NEXT_TIMESTAMP) {
next_direction_ = LEFT_NEXT;
return lt;
} else if (lt == rt) {
next_direction_ = BOTH_NEXT;
return lt;
} else if (lt < rt) {
next_direction_ = LEFT_NEXT;
return lt;
} else {
next_direction_ = RIGHT_NEXT;
return rt;
}
}
} else {
int64_t res = sss_.front();
#if DEBUG_SE
std::cout << dg.get_indent()
<< "Node::get_cur_timestamp: SRS_NODE, res=" << res
<< std::endl;
#endif
return res;
}
}