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/CompatibilityGraph.hpp"
10 namespace simgrid::mc::udpor {
12 // TODO: Remove duplication between the CompatibilityGraph
13 // and the Unfolding: they are practically identical
15 void CompatibilityGraph::remove(CompatibilityGraphNode* e)
18 throw std::invalid_argument("Expected a non-null pointer to an event, but received NULL");
23 void CompatibilityGraph::insert(std::unique_ptr<CompatibilityGraphNode> e)
25 CompatibilityGraphNode* handle = e.get();
26 auto loc = this->nodes.find(handle);
27 if (loc != this->nodes.end()) {
28 // This is bad: someone wrapped the raw event address twice
29 // in two different unique ptrs and attempted to
30 // insert it into the unfolding...
31 throw std::invalid_argument("Attempted to insert a node owned twice."
32 "This will result in a double free error and must be fixed.");
35 // Map the handle to its owner
36 this->nodes[handle] = std::move(e);
39 } // namespace simgrid::mc::udpor