Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
20521cdad79a626c7c94eec1ccb1d0f8ba8c9026
[simgrid.git] / src / cxx / Msg.cxx
1 \r
2 /*\r
3  * Msg.cxx\r
4  *\r
5  * Copyright 2006,2007 Martin Quinson, Malek Cherier           \r
6  * All right reserved. \r
7  *\r
8  * This program is free software; you can redistribute \r
9  * it and/or modify it under the terms of the license \r
10  *(GNU LGPL) which comes with this package. \r
11  *\r
12  */\r
13  \r
14  /* Msg functions implementation.\r
15   */  \r
16 \r
17 #include <MsgException.hpp>\r
18 #include <Msg.hpp>\r
19 \r
20 #include <msg/msg.h>\r
21 #include <stdio.h>\r
22 \r
23 // XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(SimGridX);\r
24 \r
25 namespace SimGrid\r
26 {\r
27         namespace Msg\r
28         {\r
29                 \r
30                 void init(int argc, char** argv)\r
31                 {\r
32                         MSG_global_init(&argc,argv);\r
33                         MSG_set_channel_number(10); // FIXME: this should not be fixed statically \r
34                 }       \r
35                 \r
36                 void finalize(void)\r
37                 throw (MsgException)\r
38                 {\r
39                         if(MSG_OK != MSG_clean())\r
40                                 throw MsgException("MSG_clean() failed");\r
41                 }\r
42                 \r
43                 void info(const char* s)\r
44                 {\r
45                          //INFO1("%s",s);\r
46                         printf("[SimGridX/info] %s\n", s);\r
47                 }\r
48 \r
49                 double getClock(void)\r
50                 {\r
51                         return MSG_get_clock();\r
52                 }\r
53 \r
54         } // namespace Msg\r
55 \r
56 } // namespace SimGrid