From: Emre T. <emr...@gm...> - 2011-03-20 18:44:11
|
Hi Dean, While looking at the documentation I see that the handler is originally designed to be a function object. That's nice, so the application developer can: - Provide a function if the case is a simple one, or - If the implementation needs state information, provide a class with a function call operator overloaded. However, the call to the Handler::log() brakes that simplicity, the handler is forced to be a class. Below are the possible solutions to this problem, with each having their own pro & cons (mostly taste related). 1. Provide an extra error argument to the function. 2. Handler::log() assumption is fine, let's force the implementation to be a class with specific handle_data() and handle_error() functions. 3. Provide 2 different handler functions, one for data and one for error. So I have provided an interface to handle all. I think being easy is nothing to do with this. Here, the interface to the application developer is easy, and the implementation is a little bit complicated. By the way there is no need of the template argument Handler in this implementation. On Mar 20, 2011, at 12:04 PM, Dean Michael Berris wrote: > On Sat, Mar 19, 2011 at 9:22 PM, Emre Türkay <emr...@gm...> wrote: >> Hi Dean. >> >> What do you say about this interface? Take a look at the various possible handlers. >> > > Hmmm... I don't understand what you're trying to accomplish here. Care > to elaborate? If it's just a matter of providing an error handler, > that should be really *easy* and not this complicated. I appreciate > the code, but I don't know what problem you're trying to solve here. > > -- > Dean Michael Berris > http://about.me/deanberris |