Open Phantom139 opened 7 years ago
You can also use std::function but EasyDelegate makes it easier to stay separated from the STL if that's still desirable here. You'll just need to replace the STL types it uses internally. EasyDelegate may also perform faster depending on how std::function is implemented (and whether or not you use the EASYDELEGATE_FORCE_INLINE directive).
I do suppose it does provide more event oriented systems right out of the box, though.
Beyond that you don't really gain anything aside from having more direct control over how the delegates behave and the deferred calls system.
Alpha 5 will add TCP Requests and HTTP Requests to the PhantomBot project. As a means to prevent unnecessary and redundant coding practices within the bot, I'm going to use the existing Socket class to handle this. The only problem is that intertwining Socket instances throughout the codebase calling send and recv back and forth may cause some undesired issues, therefore I'm going to "centralize" PlatformNetwork as a core class which is responsible for all "Socket" instances active in the bot.
This requires adding event triggers to the bot, which will require task delegation. @Ragora has provided a easy Delegate Library (https://github.com/Ragora/EasyDelegate) for my Galactic 2D project, and it works perfectly find for that application. It will work just as fine for this case as well.