Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add const attribute.
[simgrid.git] / src / s4u / s4u_Link.cpp
index c084839..b3470e5 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2018. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2013-2019. 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. */
@@ -23,16 +23,8 @@ simgrid::xbt::signal<void(Link&)> Link::on_destruction;
 simgrid::xbt::signal<void(Link&)> Link::on_state_change;
 simgrid::xbt::signal<void(Link&)> Link::on_bandwidth_change;
 simgrid::xbt::signal<void(kernel::resource::NetworkAction*, Host* src, Host* dst)> Link::on_communicate;
-simgrid::xbt::signal<void(kernel::resource::NetworkAction*)> Link::on_communication_state_change;
-
-void Link::destroy()
-{
-  if (not currentlyDestroying_) {
-    currentlyDestroying_ = true;
-    on_destruction(*this);
-    Engine::get_instance()->link_unregister(std::string(pimpl_->get_cname()));
-  }
-}
+simgrid::xbt::signal<void(kernel::resource::NetworkAction*, kernel::resource::Action::State)>
+    Link::on_communication_state_change;
 
 Link* Link::by_name(std::string name)
 {
@@ -52,10 +44,6 @@ const char* Link::get_cname() const
 {
   return this->pimpl_->get_cname();
 }
-const char* Link::name()
-{
-  return get_cname();
-}
 bool Link::is_used()
 {
   return this->pimpl_->is_used();
@@ -90,6 +78,15 @@ void Link::turn_off()
   simgrid::simix::simcall([this]() { this->pimpl_->turn_off(); });
 }
 
+bool Link::is_on() const
+{
+  return this->pimpl_->is_on();
+}
+bool Link::is_off() const
+{
+  return this->pimpl_->is_off();
+}
+
 void* Link::get_data()
 {
   return this->pimpl_->get_data();
@@ -99,20 +96,20 @@ void Link::set_data(void* d)
   simgrid::simix::simcall([this, d]() { this->pimpl_->set_data(d); });
 }
 
-void Link::set_state_trace(tmgr_trace_t trace)
+void Link::set_state_profile(kernel::profile::Profile* profile)
 {
-  simgrid::simix::simcall([this, trace]() { this->pimpl_->set_state_trace(trace); });
+  simgrid::simix::simcall([this, profile]() { this->pimpl_->set_state_profile(profile); });
 }
-void Link::set_bandwidth_trace(tmgr_trace_t trace)
+void Link::set_bandwidth_profile(kernel::profile::Profile* profile)
 {
-  simgrid::simix::simcall([this, trace]() { this->pimpl_->set_bandwidth_trace(trace); });
+  simgrid::simix::simcall([this, profile]() { this->pimpl_->set_bandwidth_profile(profile); });
 }
-void Link::set_latency_trace(tmgr_trace_t trace)
+void Link::set_latency_profile(kernel::profile::Profile* trace)
 {
-  simgrid::simix::simcall([this, trace]() { this->pimpl_->set_latency_trace(trace); });
+  simgrid::simix::simcall([this, trace]() { this->pimpl_->set_latency_profile(trace); });
 }
 
-const char* Link::get_property(const char* key)
+const char* Link::get_property(std::string key)
 {
   return this->pimpl_->get_property(key);
 }