X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/192d29ba701784b85bd2d4c9c8e65cec4c7d4f8f..da64c6383731d10c6174f81b4b6a20ff0ea186ae:/src/mc/explo/odpor/WakeupTreeIterator.hpp diff --git a/src/mc/explo/odpor/WakeupTreeIterator.hpp b/src/mc/explo/odpor/WakeupTreeIterator.hpp index 32b968c9bd..c33d483dfa 100644 --- a/src/mc/explo/odpor/WakeupTreeIterator.hpp +++ b/src/mc/explo/odpor/WakeupTreeIterator.hpp @@ -26,10 +26,15 @@ namespace simgrid::mc::odpor { * This iterator provides such a postorder traversal over the nodes in the * wakeup tree. */ -struct WakeupTreeIterator +class WakeupTreeIterator : public boost::iterator_facade { public: - WakeupTreeIterator() = default; + // Use rule-of-three, and implicitely disable the move constructor which cannot be 'noexcept' (as required by C++ Core + // Guidelines), due to the std::list and std:stack members. + WakeupTreeIterator() = default; + WakeupTreeIterator(const WakeupTreeIterator&) = default; + ~WakeupTreeIterator() = default; + explicit WakeupTreeIterator(const WakeupTree& tree); private: @@ -51,6 +56,18 @@ private: */ std::stack post_order_iteration; + /** + * @brief The nodes in the current ordering that have already + * added their own children + * + * We need to be able to determine whether to add the children + * of a given node. Eventually, we want to search that node itself, + * but we have to first search its children. Later, when we + * reach each node in this stack again, we'll remember not to add + * its children and will search the node in the stack instead. + */ + std::stack has_added_children; + /** * @brief Search the wakeup tree until a leaf node appears at the front * of the iteration, pushing all children towards the top of the stack