xbt::signal<void(Actor const&)> s4u::Actor::on_destruction;
// ***** Actor creation *****
-ActorPtr Actor::self()
+Actor* Actor::self()
{
kernel::context::Context* self_context = kernel::context::Context::self();
if (self_context == nullptr)
- return ActorPtr();
+ return nullptr;
- return self_context->get_actor()->iface();
+ return self_context->get_actor()->ciface();
}
ActorPtr Actor::init(const std::string& name, s4u::Host* host)
{
smx_actor_t self = SIMIX_process_self();
kernel::actor::ActorImpl* actor = simix::simcall([self, &name, host] { return self->init(name, host).get(); });
- return actor->ciface();
+ return actor->iface();
}
ActorPtr Actor::start(const std::function<void()>& code)
});
}
-void Actor::on_exit(int_f_pvoid_pvoid_t fun, void* data) /* deprecated */
-{
- on_exit([fun, data](bool failed) {
- intptr_t status = failed ? SMX_EXIT_FAILURE : SMX_EXIT_SUCCESS;
- fun(reinterpret_cast<void*>(status), data);
- });
-}
-
void Actor::on_exit(const std::function<void(int, void*)>& fun, void* data) /* deprecated */
{
on_exit([fun, data](bool failed) { fun(failed ? SMX_EXIT_FAILURE : SMX_EXIT_SUCCESS, data); });
simix::simcall([self] { self->kill_all(); });
}
-std::unordered_map<std::string, std::string>* Actor::get_properties()
+const std::unordered_map<std::string, std::string>* Actor::get_properties() const
{
- return simix::simcall([this] { return this->pimpl_->get_properties(); });
+ return pimpl_->get_properties();
}
/** Retrieve the property value (or nullptr if not set) */
-const char* Actor::get_property(const std::string& key)
+const char* Actor::get_property(const std::string& key) const
{
- return simix::simcall([this, &key] { return pimpl_->get_property(key); });
+ return pimpl_->get_property(key);
}
void Actor::set_property(const std::string& key, const std::string& value)
SIMIX_process_self()->iface()->migrate(new_host);
}
-std::string getName() /* deprecated */
-{
- return get_name();
-}
-const char* getCname() /* deprecated */
-{
- return get_cname();
-}
-bool isMaestro() /* deprecated */
-{
- return is_maestro();
-}
-aid_t getPid() /* deprecated */
-{
- return get_pid();
-}
-aid_t getPpid() /* deprecated */
-{
- return get_ppid();
-}
-Host* getHost() /* deprecated */
-{
- return get_host();
-}
-void on_exit(int_f_pvoid_pvoid_t fun, void* data) /* deprecated */
-{
- SIMIX_process_self()->iface()->on_exit([fun, data](int a) { fun((void*)(intptr_t)a, data); });
-}
-void onExit(int_f_pvoid_pvoid_t fun, void* data) /* deprecated */
-{
- on_exit([fun, data](int a) { fun((void*)(intptr_t)a, data); });
-}
void kill() /* deprecated */
{
exit();
{
xbt_assert(actor != nullptr, "Invalid parameter: First argument must not be nullptr");
xbt_dict_t as_dict = xbt_dict_new_homogeneous(xbt_free_f);
- std::unordered_map<std::string, std::string>* props = actor->get_properties();
+ const std::unordered_map<std::string, std::string>* props = actor->get_properties();
if (props == nullptr)
return nullptr;
for (auto const& kv : *props) {