Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add missing copyright notices.
[simgrid.git] / src / simix / smx_private.hpp
1 /* Copyright (c) 2007-2021. The SimGrid Team. All rights reserved.          */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #ifndef SIMIX_PRIVATE_HPP
7 #define SIMIX_PRIVATE_HPP
8
9 #include "simgrid/s4u/Actor.hpp"
10 #include "src/kernel/actor/ActorImpl.hpp"
11 #include "src/kernel/context/Context.hpp"
12
13 /********************************** Simix Global ******************************/
14
15 namespace simgrid {
16 namespace simix {
17
18 class Global {
19   kernel::context::ContextFactory* context_factory_ = nullptr;
20   kernel::actor::ActorImpl* maestro_                = nullptr;
21
22 public:
23   bool is_maestro(const kernel::actor::ActorImpl* actor) const { return actor == maestro_; }
24   void set_maestro(kernel::actor::ActorImpl* actor) { maestro_ = actor; }
25   kernel::actor::ActorImpl* get_maestro() const { return maestro_; }
26   void destroy_maestro()
27   {
28     delete maestro_;
29     maestro_ = nullptr;
30   }
31
32   kernel::context::ContextFactory* get_context_factory() const { return context_factory_; }
33   void set_context_factory(kernel::context::ContextFactory* factory) { context_factory_ = factory; }
34   bool has_context_factory() const { return context_factory_ != nullptr; }
35   void destroy_context_factory()
36   {
37     delete context_factory_;
38     context_factory_ = nullptr;
39   }
40 };
41 }
42 }
43
44 XBT_PUBLIC_DATA std::unique_ptr<simgrid::simix::Global> simix_global;
45
46 XBT_PUBLIC void SIMIX_clean();
47
48 #endif