Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update copyright lines.
[simgrid.git] / src / mc / remote / CheckerSide.hpp
1 /* Copyright (c) 2007-2021. 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/remote/Channel.hpp"
10
11 #include <event2/event.h>
12 #include <functional>
13
14 namespace simgrid {
15 namespace mc {
16
17 class CheckerSide {
18   struct event_base* base_    = nullptr;
19   struct event* socket_event_ = nullptr;
20   struct event* signal_event_ = nullptr;
21
22   Channel channel_;
23
24 public:
25   explicit CheckerSide(int sockfd) : channel_(sockfd) {}
26   ~CheckerSide();
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 start(void (*handler)(int, short, void*));
37   void dispatch();
38   void break_loop();
39 };
40
41 } // namespace mc
42 } // namespace simgrid
43
44 #endif