SOLA
Loading...
Searching...
No Matches
time_window.h
1// Copyright 2023 The SOLA authors
2//
3// This file is part of DAISI.
4//
5// DAISI is free software: you can redistribute it and/or modify it under the terms of the GNU
6// General Public License as published by the Free Software Foundation; version 2.
7//
8// DAISI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
9// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
10// Public License for more details.
11//
12// You should have received a copy of the GNU General Public License along with DAISI. If not, see
13// <https://www.gnu.org/licenses/>.
14//
15// SPDX-License-Identifier: GPL-2.0-only
16
17#ifndef DAISI_MATERIAL_FLOW_TIME_WINDOW_H_
18#define DAISI_MATERIAL_FLOW_TIME_WINDOW_H_
19
20#include <optional>
21
22#include "solanet/serializer/serialize.h"
23#include "utils/structure_helpers.h"
24
25namespace daisi::material_flow {
26
28public:
29 TimeWindow() = default;
30 TimeWindow(const util::Duration &earliest_start, const util::Duration &latest_finish);
31 TimeWindow(const util::Duration &earliest_start, const util::Duration &latest_finish,
32 const util::Duration &spawn_time);
33
34 const util::Duration &getRelativeEarliestStart() const;
35 const util::Duration &getRelativeLatestFinish() const;
36
37 util::Duration getAbsoluteEarliestStart() const;
38 util::Duration getAbsoluteLatestFinish() const;
39
40 bool hasSpawnTime() const;
41 void setSpawnTime(const util::Duration &spawn_time);
42
43 SERIALIZE(earliest_start_, latest_finish_, spawn_time_);
44
45private:
46 util::Duration earliest_start_ = 0.0;
47 util::Duration latest_finish_ = 0.0;
48
49 std::optional<util::Duration> spawn_time_ = std::nullopt;
50};
51
52} // namespace daisi::material_flow
53
54#endif
Definition time_window.h:27