1234567891011121314151617181920212223242526272829303132333435 |
- //
- // Created by logicp on 4/22/17.
- //
- #include <cassert>
- #include "throttle.h"
- namespace main_stronglogic {
- throttle::throttle() {
- top_position = 1;
- position = 0;
- }
- throttle::throttle(int size) {
- assert(size > 0);
- top_position = size;
- position = 0;
- }
- void throttle::shift(int amount) {
- position += amount;
- if (position < 0) {
- position = 0;
- } else if (position > top_position) {
- position = top_position;
- }
- }
- }
|