Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
convert S4U to my current coding convention
[simgrid.git] / src / s4u / s4u_engine.cpp
1 /* s4u::Engine Simulation Engine and global functions. */
2
3 /* Copyright (c) 2006-2015. The SimGrid Team. All rights reserved.          */
4
5 /* This program is free software; you can redistribute it and/or modify it
6  * under the terms of the license (GNU LGPL) which comes with this package. */
7
8 #include "simgrid/simix.h"
9 #include "mc/mc.h"
10 #include "simgrid/s4u/engine.hpp"
11
12 XBT_LOG_NEW_CATEGORY(s4u,"Log channels of the S4U (Simgrid for you) interface");
13 using namespace simgrid;
14
15 double s4u::Engine::getClock() {
16   return SIMIX_get_clock();
17 }
18
19 s4u::Engine::Engine(int *argc, char **argv) {
20   SIMIX_global_init(argc, argv);
21 }
22
23 void s4u::Engine::loadPlatform(const char *platf) {
24   SIMIX_create_environment(platf);
25 }
26
27 void s4u::Engine::registerFunction(const char*name, int (*code)(int,char**)) {
28   SIMIX_function_register(name,code);
29 }
30 void s4u::Engine::registerDefault(int (*code)(int,char**)) {
31   SIMIX_function_register_default(code);
32 }
33 void s4u::Engine::loadDeployment(const char *deploy) {
34   SIMIX_launch_application(deploy);
35 }
36
37 void s4u::Engine::run() {
38   if (MC_is_active()) {
39     MC_run();
40   } else {
41     SIMIX_run();
42   }
43 }