blob: 60d7b3bdb02b92bec91bd4b5631cae3a62381746 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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;
};
|