1 /* Copyright (c) 2004-2018. The SimGrid Team. All rights reserved. */
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. */
6 #include "simgrid/kernel/resource/Resource.hpp"
7 #include "src/kernel/lmm/maxmin.hpp" // Constraint
8 #include "src/surf/surf_interface.hpp"
14 Resource::Resource(Model* model, const std::string& name, lmm::Constraint* constraint)
15 : name_(name), model_(model), constraint_(constraint)
19 Resource::~Resource() = default;
21 bool Resource::isOn() const
25 bool Resource::isOff() const
30 void Resource::turnOn()
35 void Resource::turnOff()
40 double Resource::getLoad()
42 return constraint_->get_usage();
45 Model* Resource::model() const
50 const std::string& Resource::getName() const
55 const char* Resource::getCname() const
60 bool Resource::operator==(const Resource& other) const
62 return name_ == other.name_;
65 kernel::lmm::Constraint* Resource::constraint() const
70 } // namespace resource
72 } // namespace simgrid