1 /* Copyright (c) 2008-2023. The SimGrid Team. All rights reserved. */
3 /* This program is free software; you can redistribute it and/or modify it
4 * under the terms of the license (GNU LGPL) which comes with this package. */
6 #include "src/mc/explo/udpor/Configuration.hpp"
7 #include "src/mc/explo/udpor/History.hpp"
12 namespace simgrid::mc::udpor {
14 Configuration::Configuration(std::initializer_list<UnfoldingEvent*> events) : Configuration(EventSet(std::move(events)))
18 Configuration::Configuration(EventSet events) : events_(events)
20 if (!events_.is_valid_configuration()) {
21 throw std::invalid_argument("The events do not form a valid configuration");
25 void Configuration::add_event(UnfoldingEvent* e)
28 throw std::invalid_argument("Expected a nonnull `UnfoldingEvent*` but received NULL instead");
31 if (this->events_.contains(e)) {
35 this->events_.insert(e);
36 this->newest_event = e;
38 // Preserves the property that the configuration is valid
40 if (!this->events_.contains(history)) {
41 throw std::invalid_argument("The newly added event has dependencies "
42 "which are missing from this configuration");
46 } // namespace simgrid::mc::udpor