Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

Also for the periodic timer the implementation is taken from this link of stackoverflowthis link of stackoverflow.

Also for the periodic timer the implementation is taken from this link of stackoverflow.

Also for the periodic timer the implementation is taken from this link of stackoverflow.

replaced http://codereview.stackexchange.com/ with https://codereview.stackexchange.com/
Source Link

My Solution : This seems to me to be an observer pattern type problem, Hence I took the help and overview of observer pattern from stackexchange answerfrom stackexchange answer.

My Solution : This seems to me to be an observer pattern type problem, Hence I took the help and overview of observer pattern from stackexchange answer.

My Solution : This seems to me to be an observer pattern type problem, Hence I took the help and overview of observer pattern from stackexchange answer.

review comments added
Source Link

I have certain doubts like : [In bold are the suggestion as per @Edward]

  1. Is it too much overhead for publisher class. The timer management and to notify client at refresh_rate should be delegated too another class. : Yes , may be use priority queue.

  2. Should I use separate timer for every client or is there a better way to do it without timers at all. : The timer sleep and wake up time can managed using priority queue rather than every 1 sec.

  3. Are the Event type and other enums for handling events and data used properly. : Use shared pointers and take care of typos

  4. Is it better approach to have a function pointer from client for callback [as in the stackexchange link] rather than having client overload pure virtual function. : Yes, function pointers approach seems to be a better design

I have certain doubts like :

  1. Is it too much overhead for publisher class. The timer management and to notify client at refresh_rate should be delegated too another class.

  2. Should I use separate timer for every client or is there a better way to do it without timers at all.

  3. Are the Event type and other enums for handling events and data used properly.

  4. Is it better approach to have a function pointer from client for callback [as in the stackexchange link] rather than having client overload pure virtual function.

I have certain doubts like : [In bold are the suggestion as per @Edward]

  1. Is it too much overhead for publisher class. The timer management and to notify client at refresh_rate should be delegated too another class. : Yes , may be use priority queue.

  2. Should I use separate timer for every client or is there a better way to do it without timers at all. : The timer sleep and wake up time can managed using priority queue rather than every 1 sec.

  3. Are the Event type and other enums for handling events and data used properly. : Use shared pointers and take care of typos

  4. Is it better approach to have a function pointer from client for callback [as in the stackexchange link] rather than having client overload pure virtual function. : Yes, function pointers approach seems to be a better design

Tweeted twitter.com/StackCodeReview/status/770540388058853376
added 1 character in body
Source Link
Loading
deleted 113 characters in body
Source Link
Loading
deleted 67 characters in body
Source Link
Loading
deleted 4 characters in body
Source Link
Loading
Source Link
Loading