-
Notifications
You must be signed in to change notification settings - Fork 8
/
DirectionalOdometer.hpp
41 lines (35 loc) · 1.12 KB
/
DirectionalOdometer.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef CPP_REFACTORING_FOR_TESTABILITY_DIRECTIONALODOMETER_HPP
#define CPP_REFACTORING_FOR_TESTABILITY_DIRECTIONALODOMETER_HPP
#include "DirectionlessOdometer.hpp" // Remove this after refactoring
#include "Encoder.hpp"
#include "InterruptServiceManager.hpp"
#include "MyPinReader.hpp" // Remove this after refactoring
#include "Odometer.hpp"
#include "PinReader.hpp"
namespace before
{
struct DirectionalOdometer : public DirectionlessOdometer
{
DirectionalOdometer(int directionPin, int pulsePin, int pulsesPerMeter);
private:
MyPinReader mPinReader;
const int mDirectionPin;
};
} // namespace before
namespace after
{
struct DirectionalOdometer : public Odometer
{
DirectionalOdometer(Encoder& encoder,
InterruptServiceManager& interruptServiceManager,
PinReader& pinReader,
int directionPin,
int pulsePin);
double getDistance() const override;
private:
Encoder& mEncoder;
PinReader& mPinReader;
const int mDirectionPin;
};
} // namespace after
#endif // CPP_REFACTORING_FOR_TESTABILITY_DIRECTIONALODOMETER_HPP