2019-01-08 21:53:54 -08:00
|
|
|
/*
|
2019-04-15 16:24:46 -07:00
|
|
|
* @file global_execution_queue.h
|
2019-01-08 21:53:54 -08:00
|
|
|
*
|
|
|
|
* Created on: Jan 9, 2019
|
2020-01-07 21:02:40 -08:00
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2020
|
2019-01-08 21:53:54 -08:00
|
|
|
*/
|
|
|
|
|
2020-04-01 18:32:21 -07:00
|
|
|
#pragma once
|
2019-01-08 21:53:54 -08:00
|
|
|
|
|
|
|
#include "scheduler.h"
|
2019-01-09 17:06:41 -08:00
|
|
|
#include "event_queue.h"
|
2019-01-08 21:53:54 -08:00
|
|
|
|
|
|
|
class TestExecutor : public ExecutorInterface {
|
|
|
|
public:
|
2020-07-31 14:41:29 -07:00
|
|
|
~TestExecutor();
|
|
|
|
|
2021-07-14 13:03:00 -07:00
|
|
|
void scheduleByTimestamp(const char *msg, scheduling_s *scheduling, efitimeus_t timeUs, action_s action) override;
|
|
|
|
void scheduleByTimestampNt(const char *msg, scheduling_s *scheduling, efitick_t timeNt, action_s action) override;
|
2020-01-06 21:41:18 -08:00
|
|
|
void scheduleForLater(scheduling_s *scheduling, int delayUs, action_s action) override;
|
2021-08-27 01:30:06 -07:00
|
|
|
void cancel(scheduling_s* scheduling) override;
|
|
|
|
|
2019-01-09 07:17:35 -08:00
|
|
|
void clear();
|
2019-01-09 16:52:01 -08:00
|
|
|
int executeAll(efitime_t now);
|
2019-01-09 07:36:35 -08:00
|
|
|
int size();
|
2020-07-20 09:45:26 -07:00
|
|
|
scheduling_s * getHead();
|
|
|
|
scheduling_s * getForUnitTest(int index);
|
2020-05-14 04:44:32 -07:00
|
|
|
|
|
|
|
void setMockExecutor(ExecutorInterface* exec);
|
2019-01-09 17:06:41 -08:00
|
|
|
private:
|
|
|
|
EventQueue schedulingQueue;
|
2020-05-14 04:44:32 -07:00
|
|
|
ExecutorInterface* m_mockExecutor = nullptr;
|
2019-01-08 21:53:54 -08:00
|
|
|
};
|