virtual ~Activity() = default;
public:
+#ifndef DOXYGEN
Activity(Activity const&) = delete;
Activity& operator=(Activity const&) = delete;
+#endif
enum class State { INITED = 0, STARTED, CANCELED, ERRORED, FINISHED };
virtual Activity* cancel() = 0;
/** Retrieve the current state of the activity */
Activity::State get_state() { return state_; }
+ /** Returns whether this activity is completed */
+ virtual bool test() = 0;
/** Get the remaining amount of work that this Activity entails. When it's 0, it's done. */
virtual double get_remaining();
/** Retrieve the user data of the Activity */
void* get_user_data() { return user_data_; }
+#ifndef DOXYGEN
/** @deprecated See Activity::get_state()*/
XBT_ATTRIB_DEPRECATED_v323("Please use Activity::get_state()") Activity::State getState() { return state_; }
/** @deprecated See Activity::get_remaining() */
}
/** @deprecated See Activity::get_user_data() */
XBT_ATTRIB_DEPRECATED_v323("Please use Activity::get_user_data()") void* getUserData() { return user_data_; }
+#endif
private:
simgrid::kernel::activity::ActivityImplPtr pimpl_ = nullptr;
Activity* start() override;
Activity* wait() override;
Activity* wait(double timeout) override;
+ bool test() override;
/** Start the comm, and ignore its result. It can be completely forgotten after that. */
Activity* detach();
/** Retrieve the size of the received data */
size_t get_dst_data_size();
- bool test();
Activity* cancel() override;
/** Retrieve the mailbox on which this comm acts */
MailboxPtr get_mailbox();
+#ifndef DOXYGEN
/** @deprecated See Comm::set_rate() */
XBT_ATTRIB_DEPRECATED_v323("Please use Comm::set_rate()") Activity* setRate(double rate) { return set_rate(rate); }
/** @deprecated See Comm::set_src_data() */
}
/** @deprecated See Comm::get_mailbox() */
XBT_ATTRIB_DEPRECATED_v323("Please use Comm::get_mailbox()") MailboxPtr getMailbox() { return get_mailbox(); }
+#endif
private:
double rate_ = -1;
Activity* wait() override;
Activity* wait(double timeout) override;
Activity* cancel() override;
- bool test();
+ bool test() override;
ExecPtr set_priority(double priority);
ExecPtr set_bound(double bound);
Activity* wait() override;
Activity* wait(double timeout) override;
Activity* cancel() override;
+ bool test() override;
double get_remaining() override;
sg_size_t get_performed_ioops();
{
// TODO: this should be a simcall or something
// TODO: we are missing a version with timeout
- for (CommPtr comm : *comms) {
+ for (CommPtr comm : *comms)
comm->wait();
- }
}
Activity* Comm::set_rate(double rate)
return this;
}
+bool Io::test()
+{
+ xbt_assert(state_ == State::INITED || state_ == State::STARTED || state_ == State::FINISHED);
+
+ if (state_ == State::FINISHED)
+ return true;
+
+ if (state_ == State::INITED)
+ this->start();
+
+ THROW_UNIMPLEMENTED;
+
+ return false;
+}
+
/** @brief Returns the amount of flops that remain to be done */
double Io::get_remaining()
{