Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use `std::shared_ptr<Transition>` for Execution
[simgrid.git] / src / mc / explo / odpor / WakeupTree.hpp
index 32938f6e567d639e3f0e7cbf09260d7e062724aa..7a6eb272bcf97757c6ce124864d89630c583c678 100644 (file)
@@ -10,6 +10,7 @@
 #include "src/mc/explo/odpor/odpor_forward.hpp"
 
 #include <memory>
+#include <optional>
 #include <unordered_map>
 
 namespace simgrid::mc::odpor {
@@ -19,6 +20,8 @@ private:
   explicit WakeupTreeNode(const PartialExecution& u) : seq_(u) {}
   explicit WakeupTreeNode(PartialExecution&& u) : seq_(std::move(u)) {}
 
+  WakeupTreeNode* parent_ = nullptr;
+
   /** An ordered list of children of for this node in the tree */
   std::list<WakeupTreeNode*> children_;
 
@@ -30,6 +33,7 @@ private:
   friend WakeupTreeIterator;
 
 public:
+  ~WakeupTreeNode();
   WakeupTreeNode(const WakeupTreeNode&)            = delete;
   WakeupTreeNode(WakeupTreeNode&&)                 = default;
   WakeupTreeNode& operator=(const WakeupTreeNode&) = delete;
@@ -44,15 +48,15 @@ public:
   const std::list<WakeupTreeNode*>& get_ordered_children() const { return children_; }
   bool is_leaf() const { return children_.empty(); }
   bool is_single_process() const { return seq_.size() == static_cast<size_t>(1); }
+  aid_t get_first_actor() const;
 
   /** Insert a node `node` as a new child of this node */
-  void add_child(WakeupTreeNode* node) { this->children_.push_back(node); }
+  void add_child(WakeupTreeNode* node);
 };
 
 class WakeupTree {
 private:
-  /** @brief The root node of the tree */
-  WakeupTreeNode* const root_;
+  WakeupTreeNode* root_;
 
   /**
    * @brief All of the nodes that are currently are a part of the tree
@@ -86,7 +90,7 @@ public:
   auto end() const { return WakeupTreeIterator(); }
 
   void remove_subtree_rooted_at(WakeupTreeNode* root);
-  static WakeupTree new_subtree_rooted_at(WakeupTreeNode* root);
+  static WakeupTree make_subtree_rooted_at(WakeupTreeNode* root);
 
   /**
    * @brief Whether or not this tree is considered empty