diff --git a/cpp/examples/abm_minimal.cpp b/cpp/examples/abm_minimal.cpp index 426526c120..1912da6c0e 100644 --- a/cpp/examples/abm_minimal.cpp +++ b/cpp/examples/abm_minimal.cpp @@ -41,7 +41,6 @@ int main() model.parameters.get() = mio::ParameterDistributionLogNormal(4., 1.); // Set the age group the can go to school is AgeGroup(1) (i.e. 5-14) - model.parameters.get() = false; model.parameters.get()[age_group_5_to_14] = true; // Set the age group the can go to work is AgeGroup(2) and AgeGroup(3) (i.e. 15-34 and 35-59) model.parameters.get().set_multiple({age_group_15_to_34, age_group_35_to_59}, true); diff --git a/cpp/memilio/io/history.h b/cpp/memilio/io/history.h index 6abe2de15f..762f8b3ba0 100644 --- a/cpp/memilio/io/history.h +++ b/cpp/memilio/io/history.h @@ -21,6 +21,7 @@ #define MIO_IO_HISTORY_H #include "memilio/utils/metaprogramming.h" +#include #include #include @@ -108,6 +109,19 @@ class History return m_data; } + /** + * @brief Access the data of the given Logger. + * This function only works with Writers that stores its records in a tuple, like DataWriterToMemory. + * @return A read-only reference to the Logger's records. + */ + template + requires(is_type_in_list_v && + std::tuple_size_v == sizeof...(Loggers)) + const auto& get_log() const + { + return std::get>(m_data); + } + private: typename WriteWrapper::Data m_data; std::tuple m_loggers; @@ -127,6 +141,35 @@ class History } }; +namespace details +{ + +template +class AbstractHistory +{ +public: + template