bolar_2 backup
This commit is contained in:
35
main/schedule/alarm_schedule.h
Normal file
35
main/schedule/alarm_schedule.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
|
||||
#include "schedule/schedule_types.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
namespace borla {
|
||||
|
||||
class AlarmSchedule final {
|
||||
public:
|
||||
bool Upsert(const AlarmEntry& alarm);
|
||||
bool Delete(int32_t id);
|
||||
bool Replace(const AlarmList& alarms);
|
||||
bool EnsureBuiltInFirstDay(bool consumed);
|
||||
AlarmFireBatch TakeDue(
|
||||
const CalendarMinute& local_time,
|
||||
int64_t epoch_seconds);
|
||||
|
||||
const AlarmList& list() const { return alarms_; }
|
||||
bool first_day_consumed() const { return first_day_consumed_; }
|
||||
|
||||
static bool Validate(const AlarmEntry& alarm);
|
||||
static bool Matches(
|
||||
const AlarmEntry& alarm,
|
||||
const CalendarMinute& local_time,
|
||||
int64_t epoch_seconds);
|
||||
|
||||
private:
|
||||
AlarmList alarms_{};
|
||||
bool first_day_consumed_ = false;
|
||||
int64_t last_fired_minute_key_ = -1;
|
||||
};
|
||||
|
||||
} // namespace borla
|
||||
Reference in New Issue
Block a user