| 24 | |
| 25 | template<typename DatumType> |
| 26 | void |
| 27 | DataCollector<DatumType>::collect(const DatumType& datum) |
| 28 | { |
| 29 | if (this->onFull_ == Unbounded) { |
| 30 | this->buffer_.push_back(datum); |
| 31 | |
| 32 | } else { |
| 33 | // writeAt == bound only when we either have no buffer (bound == 0) or |
| 34 | // when we are full with no wrapping (writeAt == bound) |
| 35 | if (this->writeAt_ != this->bound_) { |
| 36 | this->buffer_[ this->writeAt_++] = datum; |
| 37 | |
| 38 | // This datum filled the buffer. |
| 39 | if (this->writeAt_ == this->bound_) { |
| 40 | this->full_ = true; |
| 41 | |
| 42 | if (this->onFull_ == KeepNewest) { |
| 43 | this->writeAt_ = 0; |
| 44 | } |
| 45 | } |
| 46 | } |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | template<typename DatumType> |
| 51 | unsigned int |
no outgoing calls
no test coverage detected