mask.h Source File

CPP API: mask.h Source File
mask.h
Go to the documentation of this file.
1 /*
2 * Copyright (C) 2020-2026 MEmilio
3 *
4 * Authors: Carlotta Gerstein, Martin J. Kuehn
5 *
6 * Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de>
7 *
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 */
20 
21 #ifndef MIO_ABM_MASK_H
22 #define MIO_ABM_MASK_H
23 
24 #include "abm/mask_type.h"
25 #include "abm/time.h"
27 
28 namespace mio
29 {
30 namespace abm
31 {
36 class Mask
37 {
38 public:
44  Mask(MaskType type, TimePoint t);
45 
50  {
51  return m_type;
52  }
53 
58  const TimeSpan get_time_used(TimePoint curr_time) const;
59 
65  void change_mask(MaskType new_mask_type, TimePoint t);
66 
69  {
70  return Members("Mask").add("mask_type", m_type).add("time_first_used", m_time_first_usage);
71  }
72 
73 private:
76 };
77 } // namespace abm
78 
80 template <>
81 struct DefaultFactory<abm::Mask> {
82  static abm::Mask create()
83  {
85  }
86 };
87 
88 } // namespace mio
89 
90 #endif
Reduces the probability that a Person becomes infected.
Definition: mask.h:37
const TimeSpan get_time_used(TimePoint curr_time) const
Get the length of time this Mask has been used.
Definition: mask.cpp:42
MaskType m_type
Type of the Mask.
Definition: mask.h:74
void change_mask(MaskType new_mask_type, TimePoint t)
Change the type of the Mask and reset the time it was used.
Definition: mask.cpp:36
TimePoint m_time_first_usage
TimePoint of the Mask's initial usage.
Definition: mask.h:75
MaskType get_type() const
Get the MaskType of this Mask.
Definition: mask.h:49
Mask(MaskType type, TimePoint t)
Construct a new Mask of a certain type.
Definition: mask.cpp:30
auto default_serialize()
This method is used by the default serialization feature.
Definition: mask.h:68
Represents a point in time.
Definition: time.h:175
A duration of time.
Definition: time.h:36
MaskType
Type of a Mask.
Definition: mask_type.h:35
A collection of classes to simplify handling of matrix shapes in meta programming.
Definition: models/abm/analyze_result.h:30
static abm::Mask create()
Definition: mask.h:82
Creates an instance of T for later initialization.
Definition: default_serialize.h:173
List of a class's members.
Definition: default_serialize.h:113
Members< ValueTypes..., T > add(const char *member_name, T &member)
Add a class member.
Definition: default_serialize.h:139