Hi
// from the registered object, get the actual pointer to the local class
_solver_instance =
std::dynamic_pointer_cast<wrapped_solver_class<sa_solver>>(
hpx::get_ptr_sync<wrapped_solver_class<sa_solver>>(_agas_Wrapper_id)
);
The call to get_ptr_sync is what I think you are looking for - it converts an
AGAS id type into a local pointer that you can use like this->do_stuff() -
assuming as you say that the component is on the local node
JB
From: [email protected]
[mailto:[email protected]] On Behalf Of Blair Archibald
Sent: 26 September 2017 17:12
To: [email protected]
Subject: [hpx-users] Local Function call in Component
Hi,
I've got a component that I would really like to be able to call a local
function
on (when I know I'm on the same locality as the component) and was wondering if
this is possible? Essentially the component manages some local state about a
locality and I want distributed calls to be able to query/add to it but I'd
also like to leak some of the internals to a local thread via shared_ptrs.
As a example we may have a component that has the following:
// Distributed access needed, works fine
int foo() {
return 42;
}
HPX_DEFINE_COMPONENT_ACTION(someComponent, foo)
// Local access only, since we can't serialize the type
std::shared_ptr<NonSerializeableType> local() {
return make_shared<NonSerializableType>();
}
// We can't do this because we can't serialize the NonSerializableType
// HPX_DEFINE_COMPONENT_ACTION(someComponent, local)
Because we only every have the gid when we use hpx::new_ I couldn't find any way
to get a reference to the actual component to call the function on it (or a way
to call a local only, non seriaizable, function via a gid).
Let me know if this isn't clear.
Many thanks,
Blair
_______________________________________________
hpx-users mailing list
[email protected]
https://mail.cct.lsu.edu/mailman/listinfo/hpx-users