-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathstop_condition.h
More file actions
40 lines (28 loc) · 923 Bytes
/
stop_condition.h
File metadata and controls
40 lines (28 loc) · 923 Bytes
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
32
33
34
35
36
37
38
39
40
//
// Created by Ravil Galiev on 21.07.2023.
//
#pragma once
#include "nlohmann/json.hpp"
namespace microbench::workload {
struct StopCondition {
virtual void start(size_t num_threads) = 0;
/**
* The purpose of the clean method is to free the resources that the StopCondition may have
* acquired after it started.
*/
virtual void clean() {};
virtual bool is_stopped(int id) = 0;
virtual std::string to_string(size_t indents = 1) = 0;
virtual void to_json(nlohmann::json& j) const = 0;
virtual void from_json(const nlohmann::json& j) = 0;
virtual ~StopCondition() = default;
};
void to_json(nlohmann::json& j, const StopCondition& s) {
s.to_json(j);
assert(j.contains("ClassName"));
// assert(j["stopConditionType"] != nullptr);
}
void from_json(const nlohmann::json& j, StopCondition& s) {
s.from_json(j);
}
} // namespace microbench::workload