Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
3247e91fd400f2726f985c43ae182beb3064dadd
[simgrid.git] / include / simgrid / s4u / VirtualMachine.hpp
1 /* Copyright (c) 2015-2016. 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 SIMGRID_S4U_VM_HPP
7 #define SIMGRID_S4U_VM_HPP
8
9 #include <simgrid/s4u/forward.hpp>
10 #include <simgrid/s4u/host.hpp>
11 #include <xbt/base.h>
12
13 typedef enum {
14   SURF_VM_STATE_CREATED, /**< created, but not yet started */
15   SURF_VM_STATE_RUNNING,
16   SURF_VM_STATE_SUSPENDED, /**< Suspend/resume does not involve disk I/O, so we assume there is no transition states. */
17 } e_surf_vm_state_t;
18
19 namespace simgrid {
20 namespace vm {
21 class VirtualMachineImpl;
22 };
23 namespace s4u {
24
25 /** @ingroup s4u_api
26  *
27  * @tableofcontents
28  *
29  * A VM is a virtual machine that contains actors. The total computing power that the contained
30  * processes can get is constrained to the virtual machine size.
31  *
32  */
33 XBT_PUBLIC_CLASS VirtualMachine : public s4u::Host
34 {
35
36 public:
37   explicit VirtualMachine(const char* name, s4u::Host* hostPm);
38
39   // No copy/move
40   VirtualMachine(VirtualMachine const&) = delete;
41   VirtualMachine& operator=(VirtualMachine const&) = delete;
42
43 private:
44   virtual ~VirtualMachine();
45
46 public:
47   bool isMigrating();
48
49   void parameters(vm_params_t params);
50   void setParameters(vm_params_t params);
51   double getRamsize();
52   simgrid::s4u::Host* pm();
53
54   /* FIXME: protect me */
55   simgrid::vm::VirtualMachineImpl* pimpl_vm_ = nullptr;
56 };
57 }
58 } // namespace simgrid::s4u
59
60 #endif /* SIMGRID_S4U_HOST_HPP */