Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
1f2d18f63a9087037533b7d2c5a1714728405fde
[simgrid.git] / src / mc / explo / udpor / CompatibilityGraphNode.hpp
1 /* Copyright (c) 2007-2023. The SimGrid Team. All rights reserved.          */
2
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. */
5
6 #ifndef SIMGRID_MC_UDPOR_COMPATIBILITY_GRAPH_NODE_HPP
7 #define SIMGRID_MC_UDPOR_COMPATIBILITY_GRAPH_NODE_HPP
8
9 #include "src/mc/explo/udpor/EventSet.hpp"
10 #include "src/mc/explo/udpor/udpor_forward.hpp"
11
12 #include <initializer_list>
13 #include <memory>
14 #include <unordered_set>
15
16 namespace simgrid::mc::udpor {
17
18 /**
19  * @brief A node in a `CompatabilityGraph` which describes which
20  * combinations of events are in causal-conflict with the events
21  * associated with the node
22  */
23 class CompatibilityGraphNode {
24 private:
25   std::unordered_set<CompatibilityGraphNode*> conflicts;
26   EventSet events_;
27
28 public:
29   CompatibilityGraphNode(const CompatibilityGraphNode&)            = default;
30   CompatibilityGraphNode& operator=(CompatibilityGraphNode const&) = default;
31   CompatibilityGraphNode(CompatibilityGraphNode&&)                 = default;
32   CompatibilityGraphNode(std::unordered_set<CompatibilityGraphNode*> conflicts, EventSet events_ = EventSet());
33
34   void add_event(UnfoldingEvent* e) { this->events_.insert(e); }
35   const EventSet& get_events() const { return this->events_; }
36   const std::unordered_set<CompatibilityGraphNode*>& get_conflicts() const { return this->conflicts; }
37 };
38
39 } // namespace simgrid::mc::udpor
40 #endif