ROSE 0.11.145.147
PathPredicate.h
1#ifndef ROSE_BinaryAnalysis_ModelChecker_PathPredicate_H
2#define ROSE_BinaryAnalysis_ModelChecker_PathPredicate_H
3#include <featureTests.h>
4#ifdef ROSE_ENABLE_MODEL_CHECKER
5
6#include <Rose/BinaryAnalysis/ModelChecker/BasicTypes.h>
7
8namespace Rose {
9namespace BinaryAnalysis {
10namespace ModelChecker {
11
13// Base class
15
33class PathPredicate {
34public:
36 using Ptr = PathPredicatePtr;
37
38protected:
39 PathPredicate();
40public:
41 virtual ~PathPredicate();
42
43public:
56 virtual std::pair<bool, const char*> operator()(const SettingsPtr&, const PathPtr&) = 0;
57 virtual std::pair<bool, const char*> test(const SettingsPtr&, const PathPtr&) final; // virtual only so we can say final
66 virtual void reset() {}
67};
68
70// Predicate that's always true.
72
76class AlwaysTrue: public PathPredicate {
77public:
78 using Ptr = AlwaysTruePtr;
79
80public:
82 static Ptr instance();
83
84 virtual std::pair<bool, const char*> operator()(const SettingsPtr&, const PathPtr&) override;
85};
86
88// Default predicate guarding the work queue.
90
96class WorkPredicate: public PathPredicate {
97public:
98 using Ptr = WorkPredicatePtr;
99
100private:
101 mutable SAWYER_THREAD_TRAITS::Mutex mutex_; // protects the following data members
102 size_t kLimitReached_ = 0; // number of times the K limit was hit
103 size_t timeLimitReached_ = 0; // number of times the time limit was hit
104
105public:
107 static Ptr instance();
108
115 size_t kLimitReached() const;
116
123 size_t timeLimitReached() const;
124
125public: // overrides
126 virtual std::pair<bool, const char*> operator()(const SettingsPtr&, const PathPtr&) override;
127 virtual void reset() override;
128};
129
131// Default predicate guarding the "interesting" queue.
133
138class HasFinalTags: public PathPredicate {
139public:
140 using Ptr = HasFinalTagsPtr;
141
142public:
144 static Ptr instance();
145
146 virtual std::pair<bool, const char*> operator()(const SettingsPtr&, const PathPtr&) override;
147};
148
149} // namespace
150} // namespace
151} // namespace
152
153#endif
154#endif
Sawyer::SharedPointer< Node > Ptr
Reference counting pointer.
The ROSE library.