*
* This method is generated only if the coroutine returns
* a value (Ret != void)
+ *
+ * @ingroup api_coroutine
*/
template <typename T = Ret>
CallerType&
*
* This method is generated only if the coroutine doesn't
* return a value (Ret = void)
+ *
+ * @ingroup api_coroutine
*/
template <typename T = Ret>
typename std::enable_if<std::is_same<T, void>::value,
* from the caller.
*
* @return arg coroutine argument
+ *
+ * @ingroup api_coroutine
*/
template <typename T = Arg>
typename std::enable_if<!std::is_same<T, void>::value, T>::type
RetChannel retChannel;
};
+ /**
+ * @ingroup api_coroutine
+ * @{
+ */
Coroutine() = delete;
Coroutine(const Coroutine& rhs) = delete;
Coroutine& operator=(const Coroutine& rhs) = delete;
+ /** @} */ // end of api_coroutine
/**
* Coroutine constructor.
* @param f task run by the coroutine
* @param run_coroutine set to false to disable running the coroutine
* immediately after it is created
+ *
+ * @ingroup api_coroutine
*/
Coroutine(std::function<void(CallerType&)> f, bool run_coroutine = true)
: Fiber(), task(f), caller(*this)
this->call();
}
+ /**
+ * @ingroup api_coroutine
+ */
virtual ~Coroutine() {}
public:
*
* This method is generated only if the coroutine takes
* arguments (Arg != void)
+ *
+ * @ingroup api_coroutine
*/
template <typename T = Arg>
Coroutine&
*
* This method is generated only if the coroutine takes
* no arguments. (Arg = void)
+ *
+ * @ingroup api_coroutine
*/
template <typename T = Arg>
typename std::enable_if<std::is_same<T, void>::value, Coroutine>::type&
* from the coroutine.
*
* @return ret yielded value
+ *
+ * @ingroup api_coroutine
*/
template <typename T = Ret>
typename std::enable_if<!std::is_same<T, void>::value, T>::type
return ret;
}
- /** Check if coroutine is still running */
+ /**
+ * Check if coroutine is still running
+ *
+ * @ingroup api_coroutine
+ */
operator bool() const { return !this->finished(); }
private: