Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add some #includes
[simgrid.git] / src / mc / ModelChecker.hpp
1 /* Copyright (c) 2007-2015. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. */
6  
7 #ifndef MC_MODEL_CHECKER_H
8 #define MC_MODEL_CHECKER_H
9
10 #include <sys/types.h>
11
12 #include <simgrid_config.h>
13 #include <xbt/dynar.h>
14
15 #include "mc_forward.h"
16 #include "mc_process.h"
17 #include "PageStore.hpp"
18 #include "mc_protocol.h"
19
20 namespace simgrid {
21 namespace mc {
22
23 /** State of the model-checker (global variables for the model checker)
24  *
25  *  Each part of the state of the model chercker represented as a global
26  *  variable prevents some sharing between snapshots and must be ignored.
27  *  By moving as much state as possible in this structure allocated
28  *  on the model-checker heap, we avoid those issues.
29  */
30 class ModelChecker {
31   /** String pool for host names */
32   // TODO, use std::unordered_set with heterogeneous comparison lookup (C++14)
33   xbt_dict_t /* <hostname, NULL> */ hostnames_;
34   // This is the parent snapshot of the current state:
35   s_mc_pages_store_t page_store_;
36   s_mc_process_t process_;
37 public:
38   ModelChecker(ModelChecker const&) = delete;
39   ModelChecker& operator=(ModelChecker const&) = delete;
40   ModelChecker(pid_t pid, int socket);
41   ~ModelChecker();
42   s_mc_process_t& process()
43   {
44     return process_;
45   }
46   PageStore& page_store()
47   {
48     return page_store_;
49   }
50   const char* get_host_name(const char* name);
51 };
52
53 }
54 }
55
56 #endif