mirror of
https://github.com/boostorg/contract.git
synced 2026-01-26 06:22:42 +00:00
39 lines
658 B
C++
Executable File
39 lines
658 B
C++
Executable File
/**
|
|
* @file
|
|
* @author Copyright (C) 2009 Lorenzo Caminiti.
|
|
* Distributed under Eiffel for C++ Software License.
|
|
*/
|
|
|
|
#ifndef DBC_PROCESS_HPP_
|
|
#define DBC_PROCESS_HPP_
|
|
|
|
namespace dbc {
|
|
|
|
class process {
|
|
public:
|
|
process(): over_(false) {}
|
|
|
|
virtual void setup() {}
|
|
virtual void step() = 0;
|
|
virtual void wrapup() {}
|
|
|
|
bool over() const { return over_; }
|
|
bool over(const bool& over) { return over_ = over; }
|
|
|
|
void operator()() { live(); }
|
|
|
|
virtual void live() {
|
|
setup();
|
|
while (!over()) { step(); }
|
|
wrapup();
|
|
}
|
|
|
|
private:
|
|
bool over_;
|
|
};
|
|
|
|
} // namespace dbc
|
|
|
|
#endif // DBC_PROCESS_HPP_
|
|
|