A class for embedded friendly callbacks.
Greetings. I'm Mikael Rosbacke and new to this list. The last couple of months I've been writing on a class for storing callbacks to different forms of callables (member functions, functors, free functions). The main focus has been to make it suitable for embedded work with small footprint and dependable exception and heap behavior. The code can be found on github: https://github.com/rosbacke/delegate It has reached a stage where I'm getting sort of 'done'. I feel it could be useful to a wider audience so I would like to get some feedback about if this is suitable for that and if it is worth starting a new branch for possibly adapting it to boost for inclusion in some future version of boost. Any feedback is appreciated. Cheers, --- Mikael Rosbacke
Em sáb, 5 de jan de 2019 às 22:13, Mikael Rosbacke via Boost < boost@lists.boost.org> escreveu:
I'm Mikael Rosbacke and new to this list. The last couple of months I've been writing on a class for storing callbacks to different forms of callables (member functions, functors, free functions). The main focus has been to make it suitable for embedded work with small footprint and dependable exception and heap behavior. The code can be found on github: https://github.com/rosbacke/delegate
Do you think your use case could be served by dyno< https://github.com/ldionne/dyno>? -- Vinícius dos Santos Oliveira https://vinipsmaker.github.io/
On 2019-01-07 11:27, Vinícius dos Santos Oliveira wrote:
Em sáb, 5 de jan de 2019 às 22:13, Mikael Rosbacke via Boost
mailto:boost@lists.boost.org> escreveu: I'm Mikael Rosbacke and new to this list. The last couple of months I've been writing on a class for storing callbacks to different forms of callables (member functions, functors, free functions). The main focus has been to make it suitable for embedded work with small footprint and dependable exception and heap behavior. The code can be found on github: https://github.com/rosbacke/delegate
Do you think your use case could be served by dynohttps://github.com/ldionne/dyno?
It is an interesting suggestion. Louis Dionne have done a deep dive into polymorphism in this case. It seems poly aims to improve on traditional runtime polymorphism with dynamic dispatching on member functions, but less use of explicit inheritance from interfaces. It seems related to Sean Parents work to avoid explicit inheritance. It does seem to be a different approach in that the delegate expands on the idea of a pointer, being a view to something else, while the 'poly' starts from the object oriented approach and want to improve on dynamic dispatch. In my case, the C++17 requirement and different meta programming dependencies are a bit daunting in an embedded setting where the toolchains often lags the standard substantially. In this case, the C++11 compatibility does matter for usability. At this point maybe C++14 is viable for broad use. One use case I see for the delegate is as an extended interrupt vector table. In micro-controllers you can set up interrupt handler to call a free function when something hardware related happens. You could hard code these to call a delegate in an array. Then drivers can register their functions to be called and got the freedom to chose member functions, free functions etc. With the delegate you get that extra data pointer storage needed to call a function on an object. --- Mikael R
-- Vinícius dos Santos Oliveira https://vinipsmaker.github.io/
participants (2)
-
Mikael Rosbacke
-
Vinícius dos Santos Oliveira