/**
* @brief A single node in a wakeup tree
*
- * Each node in a wakeup tree contains
+ * Each node in a wakeup tree represents a single step
+ * taken in an extension of the execution represented
+ * by the tree within which the node is contained. That is,
+ * a node in the tree is one step on a "pre-defined"
+ * path forward for some execution sequence. The partial
+ * execution that is implicitly represented by the node
+ * is that formed by taking each step on the (unique)
+ * path in the tree from the root node to this node.
+ * Thus, the tree itself contains all of the paths
+ * that "should be" searched, while each node is
+ * simply a step on each path.
*/
class WakeupTreeNode {
private:
- explicit WakeupTreeNode(std::shared_ptr<Transition> u) : action_(u) {}
-
WakeupTreeNode* parent_ = nullptr;
/** An ordered list of children of for this node in the tree */
friend WakeupTreeIterator;
public:
+ explicit WakeupTreeNode(std::shared_ptr<Transition> u) : action_(u) {}
+
+ WakeupTreeNode() = default;
~WakeupTreeNode() = default;
WakeupTreeNode(const WakeupTreeNode&) = delete;
WakeupTreeNode(WakeupTreeNode&&) = default;
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; }
void insert_node(std::unique_ptr<WakeupTreeNode> node);
void insert_sequence_after(WakeupTreeNode* node, const PartialExecution& w);
void remove_node(WakeupTreeNode* node);
- bool contains(WakeupTreeNode* node) const;
+ bool contains(const WakeupTreeNode* node) const;
/**
* @brief Removes the node `root` and all of its descendants from
* @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); }
+ size_t get_num_entries() const { return not empty() ? (nodes_.size() - 1) : static_cast<size_t>(0); }
/**
* @brief Returns the number of nodes in the tree, including the root node