Gainput  v1.0.0
GainputInputRecorder.h
1 
2 #ifndef GAINPUTINPUTRECORDER_H_
3 #define GAINPUTINPUTRECORDER_H_
4 
5 #ifdef GAINPUT_ENABLE_RECORDER
6 
7 namespace gainput
8 {
9 
11 
15 class GAINPUT_LIBEXPORT InputRecorder
16 {
17 public:
19 
22  InputRecorder(InputManager& manager);
24  ~InputRecorder();
25 
27 
31  void Start();
33  void Stop();
35  bool IsRecording() const { return isRecording_; }
36 
38 
42  void AddDeviceToRecord(DeviceId device) { recordedDevices_[device] = true; }
44 
47  bool IsDeviceToRecord(DeviceId device) { return recordedDevices_.empty() || recordedDevices_.count(device) > 0; }
48 
50  InputRecording* GetRecording() { return recording_; }
52  const InputRecording* GetRecording() const { return recording_; }
54  uint64_t GetStartTime() const { return startTime_; }
55 
56 private:
57  InputManager& manager_;
58 
59  bool isRecording_;
60  InputListener* recordingListener_;
61  ListenerId recordingListenerId_;
62  InputRecording* recording_;
63  uint64_t startTime_;
64  HashMap<DeviceId, bool> recordedDevices_;
65 
66 };
67 
68 }
69 
70 #endif
71 
72 #endif
73 
A recorded sequence of input changes.
Definition: GainputInputRecording.h:39
void AddDeviceToRecord(DeviceId device)
Adds a device to record the button state changes of.
Definition: GainputInputRecorder.h:42
bool IsRecording() const
Returns if the recorder is currently recording.
Definition: GainputInputRecorder.h:35
const InputRecording * GetRecording() const
Returns the recording that is being recorded to, may be 0.
Definition: GainputInputRecorder.h:52
Manages all input devices and some other helpful stuff.
Definition: GainputInputManager.h:24
bool IsDeviceToRecord(DeviceId device)
Returns if the given device should be recorded.
Definition: GainputInputRecorder.h:47
uint64_t GetStartTime() const
Returns the time the recording was started.
Definition: GainputInputRecorder.h:54
Records a sequence of button state changes.
Definition: GainputInputRecorder.h:15
Listener interface that allows to receive notifications when device button states change...
Definition: GainputInputListener.h:9
unsigned int DeviceId
ID of an input device.
Definition: gainput.h:107
unsigned int ListenerId
ID of an input listener.
Definition: gainput.h:123
InputRecording * GetRecording()
Returns the recording that is being recorded to, may be 0.
Definition: GainputInputRecorder.h:50
Contains all Gainput related classes, types, and functions.
Definition: gainput.h:103