Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use an exception on Exploration::system_exit().
[simgrid.git] / src / mc / mc_exit.hpp
1 /* Copyright (c) 2015-2023. The SimGrid Team. All rights reserved.          */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #ifndef SIMGRID_MC_EXIT_HPP
7 #define SIMGRID_MC_EXIT_HPP
8 #include "xbt/base.h"
9 #include <exception>
10
11 namespace simgrid::mc {
12
13 enum class ExitStatus {
14   SUCCESS         = 0,
15   SAFETY          = 1,
16   LIVENESS        = 2,
17   DEADLOCK        = 3,
18   NON_TERMINATION = 4,
19   NON_DETERMINISM = 5,
20   PROGRAM_CRASH   = 6,
21   ERROR           = 63
22 };
23
24 struct McError : public std::exception {
25   const ExitStatus value;
26   McError(ExitStatus v = ExitStatus::ERROR) : value(v) {}
27 };
28
29 struct DeadlockError : public McError {
30   DeadlockError() : McError(ExitStatus::DEADLOCK) {}
31 };
32 struct TerminationError : public McError {
33   TerminationError() : McError(ExitStatus::NON_TERMINATION) {}
34 };
35 struct LivenessError : public McError {
36   LivenessError() : McError(ExitStatus::LIVENESS) {}
37 };
38 } // namespace simgrid::mc
39
40 #endif