> On 07:32 Wed 18 Nov , Hartmut Kaiser wrote:
> > Ok, makes (partial) sense. Even then you should have been able to base
> your
> > initialization code on the existing mechanisms without rolling your own
> > factory object etc.
>
> I'd sure like to avoid this, but AFAIK HPX' way of registering actions
> and components relies on Macros, which I can't instantiate from a
> class template. Or maybe I'm missing something. In a Nutshell, my code
> looks like the fragment below. I'd love to have some kind of
> template-enabled registration macros like we have for the
> serialization code. If I'm not mistaken then all current component
> registration macros expect concrete types.
>
> // Library Code
> namespace LibGeoDecomp {
> template<typename CARGO>
> class HPXReceiver : public
> hpx::components::simple_component_base<HPXReceiver<CARGO> >
> {
> void receive(std::size_t step, Cargo&& val)
> { ... }
> HPX_DEFINE_COMPONENT_ACTION(HPXReceiver, receive, receiveAction);
> };
>
> template<typename CARGO>
> void foo()
> {
> HPXReceiver<CARGO> receiver;
> ...
> }
> }
>
> // User Code
> class Cell;
> LibGeoDecomp::foo<Cell>();
Now you have confused me completely. I don't see any of this in the code you
originally sent...
Moreover, you shouldn't just instantiate an HPX component like this and
expect it to be properly initialized... You will have to at least call
receiver.get_base_gid();
to make sure everything is set up properly. Also, (simple)components are
normally instantiated as:
simple_component<HPXReceiver<CARGO>>()
(see
https://github.com/STEllAR-GROUP/hpx/blob/master/hpx/runtime/components/serv
er/create_component.hpp#L28 and
https://github.com/STEllAR-GROUP/hpx/blob/master/hpx/runtime/components/serv
er/simple_component_base.hpp#L302)
HTH
Regards Hartmut
---------------
http://boost-spirit.com
http://stellar.cct.lsu.edu
_______________________________________________
hpx-users mailing list
[email protected]
https://mail.cct.lsu.edu/mailman/listinfo/hpx-users