/** Add a callback fired when an actor terminates its code.
* @beginrst
* The actor may continue to exist if it is still referenced in the simulation, but it's not active anymore.
- * If you want to free extra data when the actor's destructor is called, use :cpp:var:`Actor::on_destruction`.
+ * If you want to free extra data when the actor's destructor is called, use :cpp:func:`Actor::on_destruction_cb`.
* If you want to register to the termination of a given actor, use :cpp:func:`this_actor::on_exit()` instead.
* @endrst
*/
* If you want to register to the termination of a given actor, use this_actor::on_exit() instead.*/
static void on_destruction_cb(const std::function<void(Actor const&)>& cb) { on_destruction.connect(cb); }
- /** Create an actor from a std::function<void()>.
- * If the actor is restarted, it gets a fresh copy of the function. */
+ /** Create an actor from a @c std::function<void()>.
+ * If the actor is restarted, it gets a fresh copy of the function.
+ * @verbatim embed:rst:inline See the :ref:`example <s4u_ex_actors_create>`. @endverbatim */
static ActorPtr create(const std::string& name, s4u::Host* host, const std::function<void()>& code);
/** Create an actor, but don't start it yet.
*
ActorPtr start(const std::function<void()>& code, std::vector<std::string> args);
- /** Create an actor from a callable thing. */
+ /** Create an actor from a callable thing.
+ * @verbatim embed:rst:inline See the :ref:`example <s4u_ex_actors_create>`. @endverbatim */
template <class F> static ActorPtr create(const std::string& name, s4u::Host* host, F code)
{
return create(name, host, std::function<void()>(std::move(code)));
/** Create an actor using a callable thing and its arguments.
*
- * Note that the arguments will be copied, so move-only parameters are forbidden */
+ * Note that the arguments will be copied, so move-only parameters are forbidden.
+ * @verbatim embed:rst:inline See the :ref:`example <s4u_ex_actors_create>`. @endverbatim */
template <class F, class... Args,
// This constructor is enabled only if the call code(args...) is valid:
return create(name, host, std::bind(std::move(code), std::move(args)...));
}
- /** Create actor from function name and a vector of strings as arguments. */
+ /** Create actor from function name and a vector of strings as arguments.
+ * @verbatim embed:rst:inline See the :ref:`example <s4u_ex_actors_create>`. @endverbatim */
static ActorPtr create(const std::string& name, s4u::Host* host, const std::string& function,
std::vector<std::string> args);