85 #ifndef r_code_time_buffer_h
86 #define r_code_time_buffer_h
101 std::chrono::microseconds thz_;
102 Timestamp time_reference_;
106 void set_thz(std::chrono::microseconds thz) { thz_ = thz; }
116 T &operator *()
const {
return buffer_->cells_[cell_].data_; }
117 T *operator ->()
const {
return &(buffer_->cells_[cell_].data_); }
120 cell_ = buffer_->cells_[cell_].next_;
124 check:
if (i(buffer_->cells_[cell_].data_, buffer_->time_reference_, buffer_->thz_)) {
126 cell_ = buffer_->_erase(cell_);
133 bool operator==(
iterator &i)
const {
return cell_ == i.cell_; }
134 bool operator!=(
iterator &i)
const {
return cell_ != i.cell_; }
139 iterator begin(Timestamp time_reference) {
141 time_reference_ = time_reference;
144 iterator &end() {
return end_iterator_; }
145 iterator find(Timestamp time_reference,
const T &t) {
148 for (i = begin(time_reference); i != end(); ++i) {
153 return end_iterator_;
155 iterator find(
const T &t) {
157 for (int32 c = list<T>::used_cells_head_; c != list<T>::null_; c = list<T>::cells_[c].next_) {
159 if (list<T>::cells_[c].data_ == t)
160 return iterator(
this, c);
162 return end_iterator_;
164 iterator erase(iterator &i) {
return iterator(
this, list<T>::_erase(i.cell_)); }
167 template<
typename T,
class IsInval
idated>
typename time_buffer<T, IsInvalidated>::iterator time_buffer<T, IsInvalidated>::end_iterator_;