Added monitor_t class#15
Conversation
work in progress... added monitor_t class added monitor() method
corrected monitor_t::on_event_unknown prototype corrected indentation
modified monitor_t interface
|
Hi Edu, Why add this code to socket_t and force the overhead of the monitor stuff on everyone even if they are not using it? Wouldn't it be better to move all this code to monitor_t, you can pass in the socket and context in monitor_t's constructor. Also, making all the virtual functions in monitor_t pure virtual means anyone using it has to implement all functions, even if they are only interested in one event. Why not provide default empty methods so they can just override the ones they want? You should also add a virtual destructor to monitor_t. Ric. |
|
Hi Richard, Thanks for your comments. I think you are right. I will try to modify Thanks again for spending your time reviewing this code. Edu. On Tue, Mar 12, 2013 at 10:35 AM, Richard Newton
|
|
Hi Pieter, I think this merge is not ok with the latest version on libzmq. changes have been made to zmq_event_t structure by @guidog https://github.com/montoyaedu/libzmq/commit/21eeb03b6cab29e5f4cb60b195272314f6375678 https://github.com/montoyaedu/libzmq/commit/b0b8ab27c5a3734aa2e9103a61e1a850e14d7dd3 btw. I don't know why the following line was eliminated. I think it could be useful. please verify the following commit if you really want to merge. https://github.com/montoyaedu/cppzmq/commit/824d510bf2559c58a67ec8ff88152966b7e6305c I also changed some things adviced by @ricnewton The only part i did not implement was: "Why add this code to socket_t and force the overhead of the monitor stuff on everyone even if they are not using it? Wouldn't it be better to move all this code to monitor_t, you can pass in the socket and context in monitor_t's constructor." Right now I dont have so much time for it. please feel free to implement it. Regards, Edu. |
|
I'll wait for someone who is using C++ to make a pull request with this patch. Thanks! |
|
Hi all! @montoyaedu And the monitoring stuff needs to be in the socket because the events are generated there. Hope that clarifies some things. Cheers |
|
@guidog @ricnewton @hintjens Edu. |
|
Well, I still would move the majority out the code out into monitor_t, only the init_monitor bit needs to be in socket_t and event that could be moved to monitor_t if we made it a friend in socket_t. I'll try and re-work it how I have in mind then let you guys decide which way is better. |
|
@hintjens |
|
Usage my be something like the following snippet? |
Hello, I have added a monitor_t class to zmq.hpp for supporting zmq socket monitoring.
It should work this way.
then s->monitor(zmq::monitor_t*) should be launched within a separated thread.
zmq::monitor_t* must implement the following methods.
Please let me know if you think it could be a good idea or not.
Regards,
Edu