Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
another mc_model_checker call location disappears
[simgrid.git] / src / mc / remote / CheckerSide.hpp
1 /* Copyright (c) 2007-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_REMOTE_EVENTLOOP_HPP
7 #define SIMGRID_MC_REMOTE_EVENTLOOP_HPP
8
9 #include "src/mc/mc_forward.hpp"
10 #include "src/mc/remote/Channel.hpp"
11
12 #include <event2/event.h>
13 #include <functional>
14 #include <memory>
15
16 namespace simgrid::mc {
17
18 class CheckerSide {
19   std::unique_ptr<event_base, decltype(&event_base_free)> base_{nullptr, &event_base_free};
20   std::unique_ptr<event, decltype(&event_free)> socket_event_{nullptr, &event_free};
21   std::unique_ptr<event, decltype(&event_free)> signal_event_{nullptr, &event_free};
22
23   Channel channel_;
24
25 public:
26   explicit CheckerSide(int sockfd, ModelChecker* mc);
27
28   // No copy:
29   CheckerSide(CheckerSide const&) = delete;
30   CheckerSide& operator=(CheckerSide const&) = delete;
31   CheckerSide& operator=(CheckerSide&&) = delete;
32
33   Channel const& get_channel() const { return channel_; }
34   Channel& get_channel() { return channel_; }
35
36   void dispatch_events() const;
37   void break_loop() const;
38 };
39
40 } // namespace simgrid::mc
41
42 #endif