+std::string CommRecvTransition::to_string(bool verbose)
+{
+ textual_ = xbt::string_printf("%ld: Recv(mbox=%u", aid_, mbox_);
+ if (verbose)
+ textual_ += ", buff=" + xbt::string_printf("%p", dst_buff_);
+ textual_ += ")";
+ return textual_;
+}
+bool CommRecvTransition::depends(const Transition* other) const
+{
+ if (aid_ == other->aid_)
+ return false;
+
+ if (const auto* other_irecv = dynamic_cast<const CommRecvTransition*>(other))
+ return mbox_ == other_irecv->mbox_;
+
+ if (auto* isend = dynamic_cast<const CommSendTransition*>(other))
+ return isend->depends(this);
+
+ if (auto* wait = dynamic_cast<const CommWaitTransition*>(other)) {
+ if (wait->timeout_ > 0)
+ return true;
+
+ if (mbox_ != wait->mbox_)
+ return false;
+
+ if ((aid_ != wait->sender_) && (aid_ != wait->receiver_))
+ return false;
+
+ if (wait->dst_buff_ != dst_buff_)
+ return false;
+ }
+
+ /* FIXME: the following rule assumes that the result of the isend/irecv call is not stored in a buffer used in the
+ * test call. */
+#if 0
+ if (dynamic_cast<ActivityTestSimcall*>(other))
+ return false;
+#endif
+
+ return true;
+}
+
+CommSendTransition::CommSendTransition(aid_t issuer, int times_considered, char* buffer)
+ : Transition(issuer, times_considered)
+{
+ std::stringstream stream(buffer);
+ stream >> mbox_ >> src_buff_ >> size_;
+ XBT_DEBUG("SendTransition mbox:%u buff:%p size:%zu", mbox_, src_buff_, size_);
+}
+std::string CommSendTransition::to_string(bool verbose = false)
+{
+ textual_ = xbt::string_printf("%ld: Send(mbox=%u", aid_, mbox_);
+ if (verbose)
+ textual_ += ", buff=" + xbt::string_printf("%p", src_buff_) + ", size=" + std::to_string(size_);
+ textual_ += ")";
+ return textual_;
+}
+bool CommSendTransition::depends(const Transition* other) const
+{
+ if (aid_ == other->aid_)
+ return false;
+
+ if (const auto* other_isend = dynamic_cast<const CommSendTransition*>(other))
+ return mbox_ == other_isend->mbox_;
+
+ // FIXME: Not in the former dependency check because of the ordering but seems logical to add it
+ if (dynamic_cast<const CommRecvTransition*>(other) != nullptr)
+ return false;
+
+ if (const auto* wait = dynamic_cast<const CommWaitTransition*>(other)) {
+ if (wait->timeout_ > 0)
+ return true;
+
+ if (mbox_ != wait->mbox_)
+ return false;
+
+ if ((aid_ != wait->sender_) && (aid_ != wait->receiver_))
+ return false;
+
+ if (wait->src_buff_ != src_buff_)
+ return false;
+ }
+
+ /* FIXME: the following rule assumes that the result of the isend/irecv call is not stored in a buffer used in the
+ * test call. */
+#if 0
+ if (dynamic_cast<ActivityTestSimcall*>(other))
+ return false;
+#endif
+
+ return true;
+}
+
+Transition* recv_transition(aid_t issuer, int times_considered, kernel::actor::SimcallObserver::Simcall simcall,
+ char* buffer)
+{
+ switch (simcall) {
+ case kernel::actor::SimcallObserver::Simcall::COMM_WAIT:
+ return new CommWaitTransition(issuer, times_considered, buffer);
+ case kernel::actor::SimcallObserver::Simcall::IRECV:
+ return new CommRecvTransition(issuer, times_considered, buffer);
+ case kernel::actor::SimcallObserver::Simcall::ISEND:
+ return new CommSendTransition(issuer, times_considered, buffer);
+ case kernel::actor::SimcallObserver::Simcall::UNKNOWN:
+ return new Transition(issuer, times_considered);
+ default:
+ xbt_die("recv_transition of type %s unimplemented", kernel::actor::SimcallObserver::to_c_str(simcall));
+ }
+}
+