Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Create a s4u::VirtualMachine to clean things out.
[simgrid.git] / src / s4u / s4u_VirtualMachine.cpp
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 #include "simgrid/datatypes.h"
7 #include "simgrid/s4u/VirtualMachine.hpp"
8 #include "simgrid/s4u/host.hpp"
9 #include "simgrid/simix.hpp"
10 #include "src/surf/HostImpl.hpp"
11 #include "src/surf/VirtualMachineImpl.hpp"
12 #include "xbt/asserts.h"
13
14 namespace simgrid {
15
16 namespace s4u {
17
18 VirtualMachine::VirtualMachine(const char* name, s4u::Host* Pm) : Host(name)
19 {
20   pimpl_ = new surf::VirtualMachineImpl(this, Pm);
21 }
22
23 VirtualMachine::~VirtualMachine()
24 {
25   onDestruction(*this);
26 }
27
28 void VirtualMachine::parameters(vm_params_t params)
29 {
30   this->pimpl_->getParams(params);
31 }
32
33 void VirtualMachine::setParameters(vm_params_t params)
34 {
35   simgrid::simix::kernelImmediate([&]() { this->pimpl_->setParams(params); });
36 }
37
38 } // namespace simgrid
39 } // namespace s4u