A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add include guard.
[simgrid.git]
/
src
/
kernel
/
resource
/
Resource.cpp
diff --git
a/src/kernel/resource/Resource.cpp
b/src/kernel/resource/Resource.cpp
index 6016ae4f805819a9b2d4285ea005919fed63a29e..816ae089d52012c7353fc2d2ab8dda9ecef98d3b 100644
(file)
--- a/
src/kernel/resource/Resource.cpp
+++ b/
src/kernel/resource/Resource.cpp
@@
-3,56
+3,57
@@
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
-#include "s
rc
/kernel/resource/Resource.hpp"
+#include "s
imgrid
/kernel/resource/Resource.hpp"
#include "src/kernel/lmm/maxmin.hpp" // Constraint
#include "src/surf/surf_interface.hpp"
#include "src/kernel/lmm/maxmin.hpp" // Constraint
#include "src/surf/surf_interface.hpp"
+#include "src/surf/trace_mgr.hpp"
namespace simgrid {
namespace kernel {
namespace resource {
namespace simgrid {
namespace kernel {
namespace resource {
-Resource::Resource(
surf::
Model* model, const std::string& name, lmm::Constraint* constraint)
+Resource::Resource(Model* model, const std::string& name, lmm::Constraint* constraint)
: name_(name), model_(model), constraint_(constraint)
{
}
Resource::~Resource() = default;
: name_(name), model_(model), constraint_(constraint)
{
}
Resource::~Resource() = default;
-bool Resource::is
O
n() const
+bool Resource::is
_o
n() const
{
{
- return is
O
n_;
+ return is
_o
n_;
}
}
-bool Resource::is
O
ff() const
+bool Resource::is
_o
ff() const
{
{
- return not is
O
n_;
+ return not is
_o
n_;
}
}
-void Resource::turn
O
n()
+void Resource::turn
_o
n()
{
{
- is
O
n_ = true;
+ is
_o
n_ = true;
}
}
-void Resource::turn
O
ff()
+void Resource::turn
_o
ff()
{
{
- is
O
n_ = false;
+ is
_o
n_ = false;
}
}
-double Resource::get
L
oad()
+double Resource::get
_l
oad()
{
return constraint_->get_usage();
}
{
return constraint_->get_usage();
}
-
surf::Model* Resource::
model() const
+
Model* Resource::get_
model() const
{
return model_;
}
{
return model_;
}
-const std::string& Resource::get
N
ame() const
+const std::string& Resource::get
_n
ame() const
{
return name_;
}
{
return name_;
}
-const char* Resource::get
C
name() const
+const char* Resource::get
_c
name() const
{
return name_.c_str();
}
{
return name_.c_str();
}
@@
-62,9
+63,16
@@
bool Resource::operator==(const Resource& other) const
return name_ == other.name_;
}
return name_ == other.name_;
}
-kernel::lmm::Constraint* Resource::constraint() const
+void Resource::set_state_trace(tmgr_trace_t trace)
{
{
- return const_cast<kernel::lmm::Constraint*>(constraint_);
+ xbt_assert(state_event_ == nullptr, "Cannot set a second state trace to %s", get_cname());
+
+ state_event_ = future_evt_set.add_trace(trace, this);
+}
+
+kernel::lmm::Constraint* Resource::get_constraint() const
+{
+ return constraint_;
}
} // namespace resource
}
} // namespace resource