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
WIP stop using const char* in C++ layers
[simgrid.git]
/
src
/
surf
/
network_interface.cpp
diff --git
a/src/surf/network_interface.cpp
b/src/surf/network_interface.cpp
index
7f1e590
..
7d97da1
100644
(file)
--- a/
src/surf/network_interface.cpp
+++ b/
src/surf/network_interface.cpp
@@
-126,7
+126,7
@@
namespace simgrid {
{
if (!currentlyDestroying_) {
currentlyDestroying_ = true;
- s4u::Link::onDestruction(this);
+ s4u::Link::onDestruction(this
->piface_
);
delete this;
}
}
@@
-155,14
+155,14
@@
namespace simgrid {
{
if (isOff()) {
Resource::turnOn();
- s4u::Link::onStateChange(this);
+ s4u::Link::onStateChange(this
->piface_
);
}
}
void LinkImpl::turnOff()
{
if (isOn()) {
Resource::turnOff();
- s4u::Link::onStateChange(this);
+ s4u::Link::onStateChange(this
->piface_
);
}
}
void LinkImpl::setStateTrace(tmgr_trace_t trace)
@@
-186,11
+186,30
@@
namespace simgrid {
* Action *
**********/
- void NetworkAction::setState(Action::State state){
+ void NetworkAction::setState(Action::State state)
+ {
Action::setState(state);
s4u::Link::onCommunicationStateChange(this);
}
+ /** @brief returns a list of all Links that this action is using */
+ std::list<LinkImpl*> NetworkAction::links()
+ {
+ std::list<LinkImpl*> retlist;
+ lmm_system_t sys = getModel()->getMaxminSystem();
+ int llen = lmm_get_number_of_cnst_from_var(sys, getVariable());
+
+ for (int i = 0; i < llen; i++) {
+ /* Beware of composite actions: ptasks put links and cpus together */
+ // extra pb: we cannot dynamic_cast from void*...
+ Resource* resource = static_cast<Resource*>(lmm_constraint_id(lmm_get_cnst_from_var(sys, getVariable(), i)));
+ LinkImpl* link = dynamic_cast<LinkImpl*>(resource);
+ if (link != nullptr)
+ retlist.push_back(link);
+ }
+
+ return retlist;
+ }
}
}