Connect++ 0.1
A fast, readable connection prover for first-order logic.
Loading...
Searching...
No Matches
Schedule-16-10-23.hpp
1/*
2
3Copyright © 2023 Sean Holden. All rights reserved.
4
5*/
6/*
7
8This file is part of Connect++.
9
10Connect++ is free software: you can redistribute it and/or modify it
11under the terms of the GNU General Public License as published by the
12Free Software Foundation, either version 3 of the License, or (at your
13option) any later version.
14
15Connect++ is distributed in the hope that it will be useful, but WITHOUT
16ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18more details.
19
20You should have received a copy of the GNU General Public License along
21with Connect++. If not, see <https://www.gnu.org/licenses/>.
22
23*/
24
25#ifndef SCHEDULE_HPP
26#define SCHEDULE_HPP
27
28#include<iostream>
29#include<string>
30#include<filesystem>
31#include <fstream>
32
33#include <boost/spirit/include/qi.hpp>
34
35#include "Parameters.hpp"
36#include "Exceptions.hpp"
37
38using std::string;
39using std::vector;
40using std::ifstream;
41using std::ostream;
42using std::cout;
43using std::endl;
44using std::pair;
45using namespace boost::spirit;
46using Iter = string::const_iterator;
47
48namespace fs = std::filesystem;
49
58namespace schedule {
62enum class schedule_step {
63 conjecture,
64 limit,
65 restrict,
66 comp,
67 nocomp,
68 reorder,
69 all
70};
71string to_string(const schedule_step&);
90class Schedule {
91private:
98 vector<vector<pair<schedule_step,unsigned int>>> schedule;
102 vector<unsigned int> times;
106 size_t schedule_step_number;
110 void apply_item(const pair<schedule_step,unsigned int>&);
111public:
116 Schedule() : schedule(), times(), schedule_step_number(0) {};
121 void reset_schedule() { schedule_step_number = 0; }
128 string step_to_string(size_t) const;
136 void read_schedule_from_file(fs::path);
143 pair<bool,unsigned int> set_next_schedule();
144
145 friend ostream& operator<<(ostream&, const Schedule&);
146};
150struct add_time {
151 void operator()(unsigned int, qi::unused_type, qi::unused_type) const;
152};
156struct set_value {
157 void operator()(unsigned int, qi::unused_type, qi::unused_type) const;
158};
162struct set_step {
163 void operator()(string, qi::unused_type, qi::unused_type) const;
164};
168struct add_step {
169 void operator()(qi::unused_type, qi::unused_type) const;
170};
175 void operator()(qi::unused_type, qi::unused_type) const;
176};
177
178}
179
180#endif
Wrap up the parsing process and the operation of a schedule in a single class.
Definition Schedule-16-10-23.hpp:90
void read_schedule_from_file(fs::path)
Self-explanatory.
Definition Schedule-16-10-23.cpp:143
Schedule()
You only need this constructor because everything will be filled in by the parser.
Definition Schedule-16-10-23.hpp:116
void reset_schedule()
Go back to the beginning of the schedule but leave everything else intact.
Definition Schedule-16-10-23.hpp:121
string step_to_string(size_t) const
Make a string representation of a line in the schedule.
Definition Schedule-16-10-23.cpp:236
pair< bool, unsigned int > set_next_schedule()
Apply the settings for the next step in the schedule.
Definition Schedule-16-10-23.cpp:216
Hide all the global stuff in this namespace.
Definition Schedule-16-10-23.cpp:27
schedule_step
Possible kinds of schedule step.
Definition Schedule-16-10-23.hpp:62
Semantic action for parser.
Definition Schedule-16-10-23.hpp:168
Semantic action for parser.
Definition Schedule-16-10-23.hpp:150
Semantic action for parser.
Definition Schedule-16-10-23.hpp:174
Semantic action for parser.
Definition Schedule-16-10-23.hpp:162
Semantic action for parser.
Definition Schedule-16-10-23.hpp:156