Line data Source code
1 : /* 2 : * Copyright (C) 2020-2024 MEmilio 3 : * 4 : * Authors: David Kerkmann, Khoa Nguyen 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 : #ifndef MIO_ABM_VACCINE_H 21 : #define MIO_ABM_VACCINE_H 22 : 23 : #include "memilio/io/default_serialize.h" 24 : #include "abm/time.h" 25 : 26 : #include <cstdint> 27 : 28 : namespace mio 29 : { 30 : namespace abm 31 : { 32 : 33 : /** 34 : * @brief #ProtectionType in ABM. 35 : * can be used as 0-based index 36 : */ 37 : enum class ProtectionType : std::uint32_t 38 : { 39 : NoProtection, 40 : NaturalInfection, 41 : GenericVaccine, 42 : Count //last!! 43 : }; 44 : 45 : /** 46 : * @brief A tuple of #ProtectionType and #TimePoint. 47 : * The #TimePoint describes the time of exposure and, in case of a vaccine, the time of administration of the vaccine. 48 : */ 49 : struct ProtectionEvent { 50 2583 : ProtectionEvent(ProtectionType exposure, TimePoint t) 51 2583 : : type(exposure) 52 2583 : , time(t) 53 : { 54 2583 : } 55 : 56 : /// This method is used by the default serialization feature. 57 18 : auto default_serialize() 58 : { 59 36 : return Members("ProtectionEvent").add("type", type).add("time", time); 60 : } 61 : 62 : ProtectionType type; 63 : TimePoint time; 64 : }; 65 : 66 : } // namespace abm 67 : 68 : /// @brief Creates an instance of abm::ProtectionEvent for default serialization. 69 : template <> 70 : struct DefaultFactory<abm::ProtectionEvent> { 71 9 : static abm::ProtectionEvent create() 72 : { 73 9 : return abm::ProtectionEvent(abm::ProtectionType::Count, abm::TimePoint()); 74 : } 75 : }; 76 : 77 : } // namespace mio 78 : 79 : #endif