You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The type so_5::agent_t can be extended with these public methods:
[[nodiscard]] boolso_user_data_contains(std::type_index data_type) noexcept; // const?boolso_user_data_try_add(std::type_index data_type, std::any data_obj);
voidso_user_data_add_or_replace(std::type_index data_type, std::any data_obj);
voidso_user_data_erase(std::type_index data_type) noexcept;
// Removes the value from agent and returns it.// Throws an exception if values is not found.
[[nodiscard]] std::any
so_user_data_extract(std::type_index data_type);
[[nodiscard]] std::any*
so_user_data_find(std::type_index data_type) noexcept; // const?
This may simplify management of per-agent specific data. Like some run-time monitoring data to be collected for agent by a dispatcher.
Another example: binding of an agent to dispatcher. A disp_binder has to implement preallocate_resources for a new agent. Some disp_binders have to create a new thread for agent and this thread has to be stored somewhere until bind is called. Today it's implemented as a kind of dictionary in a dispatcher. But with user-specific data this thread object can be stored inside the agent itself as a user-data instance. Then it will be extracted in bind method.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
The type
so_5::agent_t
can be extended with these public methods:This may simplify management of per-agent specific data. Like some run-time monitoring data to be collected for agent by a dispatcher.
Another example: binding of an agent to dispatcher. A disp_binder has to implement
preallocate_resources
for a new agent. Some disp_binders have to create a new thread for agent and this thread has to be stored somewhere untilbind
is called. Today it's implemented as a kind of dictionary in a dispatcher. But with user-specific data this thread object can be stored inside the agent itself as a user-data instance. Then it will be extracted inbind
method.Beta Was this translation helpful? Give feedback.
All reactions