X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/47d230829f5847d1aed4f7aeb70ecee7a38e590d..691ad8fcfd10c7c03c272897ff3f309abadf3043:/src/s4u/s4u_Link.cpp diff --git a/src/s4u/s4u_Link.cpp b/src/s4u/s4u_Link.cpp index 8c3b4566c9..970786be86 100644 --- a/src/s4u/s4u_Link.cpp +++ b/src/s4u/s4u_Link.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2020. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2013-2021. The SimGrid Team. All rights reserved. */ /* 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. */ @@ -51,6 +51,11 @@ bool Link::is_used() const return this->pimpl_->is_used(); } +bool Link::is_shared() const +{ + return this->pimpl_->get_sharing_policy() != SharingPolicy::FATPIPE; +} + double Link::get_latency() const { return this->pimpl_->get_latency(); @@ -92,11 +97,15 @@ double Link::get_usage() const void Link::turn_on() { - simgrid::kernel::actor::simcall([this]() { this->pimpl_->turn_on(); }); + kernel::actor::simcall([this]() { this->pimpl_->turn_on(); }); } void Link::turn_off() { - simgrid::kernel::actor::simcall([this]() { this->pimpl_->turn_off(); }); + kernel::actor::simcall([this]() { this->pimpl_->turn_off(); }); +} +void Link::seal() +{ + kernel::actor::simcall([this]() { this->pimpl_->seal(); }); } bool Link::is_on() const @@ -106,25 +115,38 @@ bool Link::is_on() const void Link::set_state_profile(kernel::profile::Profile* profile) { - simgrid::kernel::actor::simcall([this, profile]() { this->pimpl_->set_state_profile(profile); }); + kernel::actor::simcall([this, profile]() { this->pimpl_->set_state_profile(profile); }); } void Link::set_bandwidth_profile(kernel::profile::Profile* profile) { - simgrid::kernel::actor::simcall([this, profile]() { this->pimpl_->set_bandwidth_profile(profile); }); + kernel::actor::simcall([this, profile]() { this->pimpl_->set_bandwidth_profile(profile); }); } void Link::set_latency_profile(kernel::profile::Profile* trace) { - simgrid::kernel::actor::simcall([this, trace]() { this->pimpl_->set_latency_profile(trace); }); + kernel::actor::simcall([this, trace]() { this->pimpl_->set_latency_profile(trace); }); } const char* Link::get_property(const std::string& key) const { return this->pimpl_->get_property(key); } -void Link::set_property(const std::string& key, const std::string& value) +Link* Link::set_property(const std::string& key, const std::string& value) +{ + kernel::actor::simcall([this, &key, &value] { this->pimpl_->set_property(key, value); }); + return this; +} + +const std::unordered_map* Link::get_properties() const +{ + return this->pimpl_->get_properties(); +} + +Link* Link::set_properties(const std::unordered_map& properties) { - simgrid::kernel::actor::simcall([this, &key, &value] { this->pimpl_->set_property(key, value); }); + kernel::actor::simcall([this, &properties] { this->pimpl_->set_properties(properties); }); + return this; } + } // namespace s4u } // namespace simgrid @@ -147,7 +169,7 @@ sg_link_t sg_link_by_name(const char* name) int sg_link_is_shared(const_sg_link_t link) { - return link->get_sharing_policy() != simgrid::s4u::Link::SharingPolicy::FATPIPE; + return link->is_shared(); } double sg_link_get_bandwidth(const_sg_link_t link)