zeromq/zmqpp

zmqpp::actor doesn't bind the callback

keith-dev opened this issue · 4 comments

With zactor, you can bind your callback to an object pointer, so the callback can use methods on that object (if an object was passed), or reference data in that structure (if the address of a struct was passed).

You cannot do this with zmqpp::actor because the callback is defined as:
typedef std::function<bool(socket *pipe)> ActorStartRoutine;

It should be defined as:
typedef std::function<bool(socket pipe, void owner)> ActorStartRoutine;

This would allow you to inherit from zmqpp::actor and further specialize it. For example, implement remote instantiation, for example.

bluca commented

That's a good suggestion, unfortunately it would be a backward-incompatible change.
What about adding a new typedef and API? Would you be able to send a PR implementing it?

xaqq commented

Ok, it never occurred to me to use bind. I'll take another look. Thanks.

I was kinda floored when I realized zmqpp wasn't simply a thin wrapper on czmq and lost heart.

xaqq commented

Yes bind should work for your case.
However, if you're looking at a wrapper around czmq there is https://github.com/zeromq/czmqpp. I've never used it so I don't know how complete it is etc.