Inferno
0.2
|
00001 #ifndef CONJECTURE_HPP 00002 #define CONJECTURE_HPP 00003 00004 #include "common/common.hpp" 00005 //#include "coupling.hpp" 00006 #include <vector> 00007 00008 class CompareReplace; 00009 00010 00011 class Conjecture 00012 { 00013 public: 00014 struct Choice 00015 { 00016 ContainerInterface::iterator it; 00017 ContainerInterface::iterator end; 00018 int end_count; 00019 int end_num; 00020 bool forced; 00021 }; 00022 public: 00023 Conjecture(); 00024 ~Conjecture(); 00025 void PrepareForDecidedCompare(); 00026 bool Increment(); // returns true for try again, false for give up 00027 00028 // General note: decided compare functions should call one of HandleDecision() or 00029 // GetDecision() before calling other functions like ReportDecision() or 00030 // ForceDecision(). 00031 00032 // Standard interface for decided compare functions 00033 ContainerInterface::iterator HandleDecision( ContainerInterface::iterator begin, 00034 ContainerInterface::iterator end, 00035 int en=0 ); 00036 // Version that forces the decision down to a single choice 00037 ContainerInterface::iterator HandleDecision( ContainerInterface::iterator only ); 00038 00039 Choice *GetChoicePtr() { return decision_index < choices.size() ? &choices[decision_index] : NULL; } // TODO should be const ptr 00040 Choice *GetPrevChoicePtr() { return (decision_index>0 && decision_index-1 < choices.size()) ? &choices[decision_index-1] : NULL; } // TODO should be const ptr 00041 00042 private: 00043 int decision_index; 00044 vector<Choice> choices; 00045 00046 // Tracing stuff 00047 void ResizeCounts(); 00048 vector<int> inc_counts; 00049 vector<int> start_counts; 00050 vector<string> it_names; 00051 bool failed; 00052 }; 00053 00054 #endif