diff options
author | Cristian Cadar <c.cadar@imperial.ac.uk> | 2023-12-14 22:15:57 +0000 |
---|---|---|
committer | MartinNowack <2443641+MartinNowack@users.noreply.github.com> | 2024-01-12 12:00:35 +0000 |
commit | 2c8b74cc858793c94e5476b5765e93ee23738702 (patch) | |
tree | 8d4005084ef0ae0f2d7eb72333855e15526ace25 /tools/klee-exec-tree/DFSVisitor.h | |
parent | 5ca8f5a020cca251a0d5d08bc855bf945735c1af (diff) | |
download | klee-2c8b74cc858793c94e5476b5765e93ee23738702.tar.gz |
Rename files from PTree to ExecutionTree (and similar)
Diffstat (limited to 'tools/klee-exec-tree/DFSVisitor.h')
-rw-r--r-- | tools/klee-exec-tree/DFSVisitor.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tools/klee-exec-tree/DFSVisitor.h b/tools/klee-exec-tree/DFSVisitor.h new file mode 100644 index 00000000..60d7b3bd --- /dev/null +++ b/tools/klee-exec-tree/DFSVisitor.h @@ -0,0 +1,31 @@ +//===-- DFSVisitor.h --------------------------------------------*- C++ -*-===// +// +// The KLEE Symbolic Virtual Machine +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#pragma once + +#include "Tree.h" + +#include <functional> + +/// @brief Traverses a process tree and calls registered callbacks for +/// intermediate and leaf nodes (not the classical Visitor pattern). +class DFSVisitor { + // void _(node ID, node, depth) + using callbackT = std::function<void(std::uint32_t, Node, std::uint32_t)>; + + const Tree &tree; + callbackT cb_intermediate; + callbackT cb_leaf; + void run() const noexcept; + +public: + DFSVisitor(const Tree &tree, callbackT cb_intermediate, + callbackT cb_leaf) noexcept; + ~DFSVisitor() = default; +}; |