As this library already requires C++ 14 , using std::function (https://en.cppreference.com/w/cpp/utility/functional/function) for the notifications should improve the usability a lot (e.g. bind to class members, use custom handler types, ...). As a function pointer can be bound to an std::function, too, this would not break existing code.
This would require changes in these places:
|
AdsHandle AdsDevice::GetHandle(const uint32_t indexGroup, |
|
const uint32_t indexOffset, |
|
const AdsNotificationAttrib& notificationAttributes, |
|
PAdsNotificationFuncEx callback, |
|
const uint32_t hUser) const |
|
long AdsSyncAddDeviceNotificationReqEx(long port, |
|
const AmsAddr* pAddr, |
|
uint32_t indexGroup, |
|
uint32_t indexOffset, |
|
const AdsNotificationAttrib* pAttrib, |
|
PAdsNotificationFuncEx pFunc, |
|
uint32_t hUser, |
|
uint32_t* pNotification) |
PS: I'm aware that this is a feature request, but I just want to get a general opinion about this, before I potentially work on this.
As this library already requires C++ 14 , using std::function (https://en.cppreference.com/w/cpp/utility/functional/function) for the notifications should improve the usability a lot (e.g. bind to class members, use custom handler types, ...). As a function pointer can be bound to an std::function, too, this would not break existing code.
This would require changes in these places:
ADS/AdsLib/AdsNotificationOOI.h
Line 14 in 3824918
ADS/AdsLib/AdsDevice.cpp
Lines 83 to 87 in 3824918
ADS/AdsLib/standalone/AdsLib.cpp
Lines 261 to 268 in 3824918
ADS/AdsLib/AdsNotification.h
Line 15 in 3824918
PS: I'm aware that this is a feature request, but I just want to get a general opinion about this, before I potentially work on this.