X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/ed48bb9aa5dc358f65a2e4e854d3b8c49bef5273..ac080087b39ef79ff497d3992ff04b3e20fe40b2:/src/s4u/s4u_Link.cpp diff --git a/src/s4u/s4u_Link.cpp b/src/s4u/s4u_Link.cpp index 20cf1d1f4c..bb48a1bb1f 100644 --- a/src/s4u/s4u_Link.cpp +++ b/src/s4u/s4u_Link.cpp @@ -18,20 +18,20 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(s4u_link, s4u, "Logging specific to the S4U link namespace simgrid { namespace s4u { -simgrid::xbt::signal Link::on_creation; -simgrid::xbt::signal Link::on_destruction; -simgrid::xbt::signal Link::on_state_change; -simgrid::xbt::signal Link::on_bandwidth_change; -simgrid::xbt::signal Link::on_communicate; -simgrid::xbt::signal +xbt::signal Link::on_creation; +xbt::signal Link::on_destruction; +xbt::signal Link::on_state_change; +xbt::signal Link::on_bandwidth_change; +xbt::signal Link::on_communicate; +xbt::signal Link::on_communication_state_change; -Link* Link::by_name(std::string name) +Link* Link::by_name(const std::string& name) { return Engine::get_instance()->link_by_name(name); } -Link* Link::by_name_or_null(std::string name) +Link* Link::by_name_or_null(const std::string& name) { return Engine::get_instance()->link_by_name_or_null(name); } @@ -49,12 +49,12 @@ bool Link::is_used() return this->pimpl_->is_used(); } -double Link::get_latency() +double Link::get_latency() const { return this->pimpl_->get_latency(); } -double Link::get_bandwidth() +double Link::get_bandwidth() const { return this->pimpl_->get_bandwidth(); } @@ -71,51 +71,38 @@ double Link::get_usage() void Link::turn_on() { - simgrid::simix::simcall([this]() { this->pimpl_->turn_on(); }); + simgrid::kernel::actor::simcall([this]() { this->pimpl_->turn_on(); }); } void Link::turn_off() { - simgrid::simix::simcall([this]() { this->pimpl_->turn_off(); }); + simgrid::kernel::actor::simcall([this]() { this->pimpl_->turn_off(); }); } -bool Link::is_on() +bool Link::is_on() const { return this->pimpl_->is_on(); } -bool Link::is_off() -{ - return this->pimpl_->is_off(); -} - -void* Link::get_data() -{ - return this->pimpl_->get_data(); -} -void Link::set_data(void* d) -{ - simgrid::simix::simcall([this, d]() { this->pimpl_->set_data(d); }); -} void Link::set_state_profile(kernel::profile::Profile* profile) { - simgrid::simix::simcall([this, profile]() { this->pimpl_->set_state_profile(profile); }); + simgrid::kernel::actor::simcall([this, profile]() { this->pimpl_->set_state_profile(profile); }); } void Link::set_bandwidth_profile(kernel::profile::Profile* profile) { - simgrid::simix::simcall([this, profile]() { this->pimpl_->set_bandwidth_profile(profile); }); + simgrid::kernel::actor::simcall([this, profile]() { this->pimpl_->set_bandwidth_profile(profile); }); } void Link::set_latency_profile(kernel::profile::Profile* trace) { - simgrid::simix::simcall([this, trace]() { this->pimpl_->set_latency_profile(trace); }); + simgrid::kernel::actor::simcall([this, trace]() { this->pimpl_->set_latency_profile(trace); }); } -const char* Link::get_property(std::string key) +const char* Link::get_property(const std::string& key) const { return this->pimpl_->get_property(key); } -void Link::set_property(std::string key, std::string value) +void Link::set_property(const std::string& key, const std::string& value) { - simgrid::simix::simcall([this, key, value] { this->pimpl_->set_property(key, value); }); + simgrid::kernel::actor::simcall([this, &key, &value] { this->pimpl_->set_property(key, value); }); } } // namespace s4u } // namespace simgrid @@ -160,7 +147,7 @@ sg_link_t* sg_link_list() { std::vector links = simgrid::s4u::Engine::get_instance()->get_all_links(); - sg_link_t* res = (sg_link_t*)malloc(sizeof(sg_link_t) * links.size()); + sg_link_t* res = xbt_new(sg_link_t, links.size()); memcpy(res, links.data(), sizeof(sg_link_t) * links.size()); return res;