]> granicus.if.org Git - icinga2/blob - lib/icinga/timeperiod.hpp
Correct current_concurrent_checks to actually running checks
[icinga2] / lib / icinga / timeperiod.hpp
1 /* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
2
3 #ifndef TIMEPERIOD_H
4 #define TIMEPERIOD_H
5
6 #include "icinga/i2-icinga.hpp"
7 #include "icinga/timeperiod-ti.hpp"
8
9 namespace icinga
10 {
11
12 /**
13  * A time period.
14  *
15  * @ingroup icinga
16  */
17 class TimePeriod final : public ObjectImpl<TimePeriod>
18 {
19 public:
20         DECLARE_OBJECT(TimePeriod);
21         DECLARE_OBJECTNAME(TimePeriod);
22
23         void Start(bool runtimeCreated) override;
24
25         void UpdateRegion(double begin, double end, bool clearExisting);
26
27         bool GetIsInside() const override;
28
29         bool IsInside(double ts) const;
30         double FindNextTransition(double begin);
31
32         void ValidateRanges(const Lazy<Dictionary::Ptr>& lvalue, const ValidationUtils& utils) override;
33
34 private:
35         void AddSegment(double s, double end);
36         void AddSegment(const Dictionary::Ptr& segment);
37         void RemoveSegment(double begin, double end);
38         void RemoveSegment(const Dictionary::Ptr& segment);
39         void PurgeSegments(double end);
40
41         void Merge(const TimePeriod::Ptr& timeperiod, bool include = true);
42
43         void Dump();
44
45         static void UpdateTimerHandler();
46 };
47
48 }
49
50 #endif /* TIMEPERIOD_H */