Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Move Server in simgrid::mc
[simgrid.git] / src / mc / Server.hpp
similarity index 74%
rename from src/mc/mc_server.h
rename to src/mc/Server.hpp
index 9daf0dd..1c82e5a 100644 (file)
@@ -4,13 +4,11 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
-#ifndef SIMGRID_MC_SERVER_H
-#define SIMGRID_MC_SERVER_H
+#ifndef SIMGRID_MC_SERVER_HPP
+#define SIMGRID_MC_SERVER_HPP
 
 #include <poll.h>
 
-#include <stdbool.h>
-
 #include <sys/signalfd.h>
 #include <sys/types.h>
 
 #include "src/mc/Process.hpp"
 #include "mc_exit.h"
 
-SG_BEGIN_DECL()
-
-#define MC_SERVER_ERROR SIMGRID_ERROR
-
-typedef struct s_mc_server s_mc_server_t, *mc_server_t;
-
-extern mc_server_t mc_server;
+namespace simgrid {
+namespace mc {
 
-SG_END_DECL()
-
-#ifdef __cplusplus
-
-struct s_mc_server {
+class Server {
 private:
   pid_t pid;
   int socket;
   struct pollfd fds[2];
 public:
-  s_mc_server(pid_t pid, int socket);
+  Server(pid_t pid, int socket);
   void start();
   void shutdown();
   void exit();
@@ -54,6 +43,9 @@ private:
   void on_signal(const struct signalfd_siginfo* info);
 };
 
-#endif
+extern Server* server;
+
+}
+}
 
 #endif