Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Detect/fix conflicting visibility and fix visibility wrt lua/java bindings
[simgrid.git] / src / mc / ModelChecker.cpp
1 /* Copyright (c) 2008-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 #include <cassert>
8
9 #include "ModelChecker.hpp"
10 #include "PageStore.hpp"
11
12 ::simgrid::mc::ModelChecker* mc_model_checker = NULL;
13
14 namespace simgrid {
15 namespace mc {
16
17 ModelChecker::ModelChecker(pid_t pid, int socket) :
18   hostnames_(xbt_dict_new()),
19   page_store_(500),
20   process_(pid, socket)
21 {
22 }
23
24 ModelChecker::~ModelChecker()
25 {
26   xbt_dict_free(&this->hostnames_);
27 }
28
29 const char* ModelChecker::get_host_name(const char* hostname)
30 {
31   // Lookup the host name in the dictionary (or create it):
32   xbt_dictelm_t elt = xbt_dict_get_elm_or_null(this->hostnames_, hostname);
33   if (!elt) {
34     xbt_dict_set(this->hostnames_, hostname, NULL, NULL);
35     elt = xbt_dict_get_elm_or_null(this->hostnames_, hostname);
36     assert(elt);
37   }
38   return elt->key;
39 }
40
41 }
42 }