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::is_on() const
25 bool Resource::is_off() const
30 void Resource::turn_on()
35 void Resource::turn_off()
40 double Resource::get_load()
42 return constraint_->get_usage();
45 Model* Resource::get_model() const
50 const std::string& Resource::get_name() const
55 const char* Resource::get_cname() const
60 bool Resource::operator==(const Resource& other) const
62 return name_ == other.name_;
65 kernel::lmm::Constraint* Resource::get_constraint() const
70 } // namespace resource
72 } // namespace simgrid