Skip to content

Commit c236205

Browse files
author
Karl Herbig
committed
[message] change Callback from simple pointer to std::function; enables use of methods and lambda captures
1 parent 546b4c9 commit c236205

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

include/modbuspp/message.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <stdexcept>
2121
#include <vector>
2222
#include <iostream>
23+
#include <functional>
2324
#include <modbuspp/global.h>
2425
#include <modbuspp/data.h>
2526

@@ -46,7 +47,7 @@ namespace Modbus {
4647
* @return 1 if the message has been completely processed, 0 if the
4748
* message has not been processed, -1 if error.
4849
*/
49-
typedef int (*Callback) (Message * msg, Device * sender);
50+
using Callback = std::function<int(Message*, Device*)>;
5051

5152
/**
5253
* @brief Constructors

0 commit comments

Comments
 (0)