-}
-
-void Comm::setSrcData(void * buff) {
- xbt_assert(state_==inited);
- xbt_assert(dstBuff_ == nullptr, "Cannot set the src and dst buffers at the same time");
- srcBuff_ = buff;
-}
-void Comm::setSrcDataSize(size_t size){
- xbt_assert(state_==inited);
- srcBuffSize_ = size;
-}
-void Comm::setSrcData(void * buff, size_t size) {
- xbt_assert(state_==inited);
-
- xbt_assert(dstBuff_ == nullptr, "Cannot set the src and dst buffers at the same time");
- srcBuff_ = buff;
- srcBuffSize_ = size;
-}
-void Comm::setDstData(void ** buff) {
- xbt_assert(state_==inited);
- xbt_assert(srcBuff_ == nullptr, "Cannot set the src and dst buffers at the same time");
- dstBuff_ = buff;
-}
-size_t Comm::getDstDataSize(){
- xbt_assert(state_==finished);
- return dstBuffSize_;
-}
-void Comm::setDstData(void ** buff, size_t size) {
- xbt_assert(state_==inited);
-
- xbt_assert(srcBuff_ == nullptr, "Cannot set the src and dst buffers at the same time");
- dstBuff_ = buff;
- dstBuffSize_ = size;
-}
-
-void Comm::start() {
- xbt_assert(state_ == inited);
-
- if (srcBuff_ != nullptr) { // Sender side
- pimpl_ = simcall_comm_isend(sender_, mailbox_->getInferior(), remains_, rate_,
- srcBuff_, srcBuffSize_,
- matchFunction_, cleanFunction_, copyDataFunction_,
- userData_, detached_);
- } else if (dstBuff_ != nullptr) { // Receiver side
- pimpl_ = simcall_comm_irecv(receiver_, mailbox_->getInferior(), dstBuff_, &dstBuffSize_,
- matchFunction_, copyDataFunction_,
- userData_, rate_);
+ return this;
+}
+
+Activity* Comm::set_src_data(void* buff)
+{
+ xbt_assert(state_ == State::inited);
+ xbt_assert(dst_buff_ == nullptr, "Cannot set the src and dst buffers at the same time");
+ src_buff_ = buff;
+ return this;
+}
+Activity* Comm::set_src_data_size(size_t size)
+{
+ xbt_assert(state_ == State::inited);
+ src_buff_size_ = size;
+ return this;
+}
+Activity* Comm::set_src_data(void* buff, size_t size)
+{
+ xbt_assert(state_ == State::inited);
+
+ xbt_assert(dst_buff_ == nullptr, "Cannot set the src and dst buffers at the same time");
+ src_buff_ = buff;
+ src_buff_size_ = size;
+ return this;
+}
+Activity* Comm::set_dst_data(void** buff)
+{
+ xbt_assert(state_ == State::inited);
+ xbt_assert(src_buff_ == nullptr, "Cannot set the src and dst buffers at the same time");
+ dst_buff_ = buff;
+ return this;
+}
+size_t Comm::get_dst_data_size()
+{
+ xbt_assert(state_ == State::finished);
+ return dst_buff_size_;
+}
+Activity* Comm::set_dst_data(void** buff, size_t size)
+{
+ xbt_assert(state_ == State::inited);
+
+ xbt_assert(src_buff_ == nullptr, "Cannot set the src and dst buffers at the same time");
+ dst_buff_ = buff;
+ dst_buff_size_ = size;
+ return this;
+}
+
+Activity* Comm::start()
+{
+ xbt_assert(state_ == State::inited);
+
+ if (src_buff_ != nullptr) { // Sender side
+ pimpl_ = simcall_comm_isend(sender_, mailbox_->get_impl(), remains_, rate_, src_buff_, src_buff_size_, match_fun_,
+ clean_fun_, copy_data_function_, user_data_, detached_);
+ } else if (dst_buff_ != nullptr) { // Receiver side
+ xbt_assert(not detached_, "Receive cannot be detached");
+ pimpl_ = simcall_comm_irecv(receiver_, mailbox_->get_impl(), dst_buff_, &dst_buff_size_, match_fun_,
+ copy_data_function_, user_data_, rate_);