- XBT_IN("(%s,%s,%g,%g)", src_name, dst_name, size, rate);
- NetworkConstantActionPtr action = new NetworkConstantAction(this, size, sg_latency_factor);
- XBT_OUT();
-
- return action;
-}
-
-/************
- * Resource *
- ************/
-bool NetworkConstantLink::isUsed()
-{
- return 0;
-}
-
-void NetworkConstantLink::updateState(tmgr_trace_event_t /*event_type*/,
- double /*value*/, double /*time*/)
-{
- DIE_IMPOSSIBLE;
-}
-
-double NetworkConstantLink::getBandwidth()
-{
- DIE_IMPOSSIBLE;
- return -1.0; /* useless since DIE actually abort(), but eclipse prefer to have a useless and harmless return */
-}
+ void NetworkConstantModel::updateActionsState(double /*now*/, double delta)
+ {
+ NetworkConstantAction *action = nullptr;
+ ActionList *actionSet = getRunningActionSet();
+ for(ActionList::iterator it(actionSet->begin()), itNext=it, itend(actionSet->end())
+ ; it != itend ; it=itNext) {
+ ++itNext;
+ action = static_cast<NetworkConstantAction*>(&*it);
+ if (action->latency_ > 0) {
+ if (action->latency_ > delta) {
+ double_update(&(action->latency_), delta, sg_surf_precision);
+ } else {
+ action->latency_ = 0.0;
+ }
+ }
+ action->updateRemains(action->getCost() * delta / action->initialLatency_);
+ if (action->getMaxDuration() != NO_MAX_DURATION)
+ action->updateMaxDuration(delta);
+
+ if (action->getRemainsNoUpdate() <= 0) {
+ action->finish();
+ action->setState(Action::State::done);
+ } else if ((action->getMaxDuration() != NO_MAX_DURATION)
+ && (action->getMaxDuration() <= 0)) {
+ action->finish();
+ action->setState(Action::State::done);
+ }
+ }
+ }