| 42 | : public Elevator |
| 43 | { |
| 44 | void react(FloorSensor const & e) override { |
| 45 | int floor_expected = current_floor + Motor::getDirection(); |
| 46 | if(floor_expected != e.floor) |
| 47 | { |
| 48 | std::cout << "Floor sensor defect (expected " << floor_expected << ", got " << e.floor << ")" << std::endl; |
| 49 | transit<Panic>(CallMaintenance); |
| 50 | } |
| 51 | else |
| 52 | { |
| 53 | std::cout << "Reached floor " << e.floor << std::endl; |
| 54 | current_floor = e.floor; |
| 55 | if(e.floor == dest_floor) |
| 56 | transit<Idle>(); |
| 57 | } |
| 58 | }; |
| 59 | }; |
| 60 | |
| 61 |
nothing calls this directly
no outgoing calls
no test coverage detected