WakeupTreeNode& operator=(const WakeupTreeNode&) = delete;
WakeupTreeNode& operator=(WakeupTreeNode&&) = default;
- const auto begin() const { return this->children_.begin(); }
- const auto end() const { return this->children_.end(); }
- const auto rbegin() const { return this->children_.rbegin(); }
- const auto rend() const { return this->children_.rend(); }
+ auto begin() const { return this->children_.begin(); }
+ auto end() const { return this->children_.end(); }
+ auto rbegin() const { return this->children_.rbegin(); }
+ auto rend() const { return this->children_.rend(); }
bool is_leaf() const { return children_.empty(); }
bool is_root() const { return parent_ == nullptr; }
*/
bool empty() const { return nodes_.size() == static_cast<size_t>(1); }
+ /**
+ * @brief Returns the number of *non-empty* entries in the tree, viz. the
+ * number of nodes in the tree that have an action mapped to them
+ */
+ size_t get_num_entries() const { return !empty() ? (nodes_.size() - 1) : static_cast<size_t>(0); }
+
+ /**
+ * @brief Returns the number of nodes in the tree, including the root node
+ */
+ size_t get_num_nodes() const { return nodes_.size(); }
+
/**
* @brief Gets the actor of the node that is the "smallest" (with respect
* to the tree's "<" relation) single-process node.
*/
std::optional<WakeupTreeNode*> get_min_single_process_node() const;
+ /** @brief Describes how a tree insertion was carried out */
+ enum class InsertionResult { leaf, interior_node, root };
+
/**
* @brief Inserts an sequence `seq` of processes into the tree
* such that that this tree is a wakeup tree relative to the
*
* @invariant: It is assumed that this tree is a wakeup tree
* with respect to the given execution `E`
+ *
+ * @return Whether a sequence equivalent to `seq` is already contained
+ * as a leaf node in the tree
*/
- void insert(const Execution& E, const PartialExecution& seq);
+ InsertionResult insert(const Execution& E, const PartialExecution& seq);
};
} // namespace simgrid::mc::odpor