namespace kernel {
namespace activity {
-IoImpl::~IoImpl()
-{
- if (surf_action_ != nullptr)
- surf_action_->unref();
- XBT_DEBUG("Destroy io %p", this);
-}
-
-IoImplPtr IoImpl::set_name(const std::string& name)
-{
- ActivityImpl::set_name(name);
- return this;
-}
-
-IoImplPtr IoImpl::set_type(s4u::Io::OpType type)
+IoImpl& IoImpl::set_type(s4u::Io::OpType type)
{
type_ = type;
- return this;
+ return *this;
}
-IoImplPtr IoImpl::set_size(sg_size_t size)
+IoImpl& IoImpl::set_size(sg_size_t size)
{
size_ = size;
- return this;
+ return *this;
}
-IoImplPtr IoImpl::set_storage(resource::StorageImpl* storage)
+IoImpl& IoImpl::set_storage(resource::StorageImpl* storage)
{
storage_ = storage;
- return this;
+ return *this;
}
IoImpl* IoImpl::start()
surf_action_->set_data(this);
XBT_DEBUG("Create IO synchro %p %s", this, get_cname());
- IoImpl::on_start(this);
+ IoImpl::on_start(*this);
return this;
}
-void IoImpl::cancel()
-{
- XBT_VERB("This exec %p is canceled", this);
- if (surf_action_ != nullptr)
- surf_action_->cancel();
- state_ = SIMIX_CANCELED;
-}
-
-double IoImpl::get_remaining()
-{
- return surf_action_ ? surf_action_->get_remains() : 0;
-}
-
void IoImpl::post()
{
performed_ioops_ = surf_action_->get_cost();
default:
THROW_IMPOSSIBLE;
}
- on_completion(this);
+ on_completion(*this);
finish();
}
/*************
* Callbacks *
*************/
-xbt::signal<void(IoImplPtr)> IoImpl::on_start;
-xbt::signal<void(IoImplPtr)> IoImpl::on_completion;
+xbt::signal<void(IoImpl const&)> IoImpl::on_start;
+xbt::signal<void(IoImpl const&)> IoImpl::on_completion;
} // namespace activity
} // namespace kernel