replace typedef function ptr by std::function

start PIMap refactoring
This commit is contained in:
Бычков Андрей
2022-07-29 15:49:36 +03:00
parent 38fd1b5dc4
commit 4725eb96d6
9 changed files with 65 additions and 87 deletions

View File

@@ -29,10 +29,17 @@
#include "piiodevice.h"
/// TODO: написать документацию, тут ничего не понятно
// Pass data, recHeaderPtr, received_data, recHeaderSize. Return true if packet is correct nor return false.
typedef int (*PacketExtractorHeaderFunc)(const uchar *, const uchar *, int);
typedef bool (*PacketExtractorPayloadFunc)(const uchar *, int);
typedef bool (*PacketExtractorFooterFunc)(const uchar *, const uchar *, int);
/// Pass SourceHeaderPtr, ReceivedHeaderPtr, HeaderSize.
/// Return size of payload if packet is correct, or -1 if incorrect.
typedef std::function<int(const uchar *, const uchar *, int)> PacketExtractorHeaderFunc;
/// Pass ReceivedDataPtr, DataSize.
/// Return true if packet is correct, false otherwise.
typedef std::function<bool(const uchar *, int)> PacketExtractorPayloadFunc;
/// Pass SourceFooterPtr, ReceivedFooterPtr, FooterSize.
/// Return true if packet is correct, false otherwise.
typedef std::function<bool(const uchar *, const uchar *, int)> PacketExtractorFooterFunc;
class PIP_EXPORT PIPacketExtractor: public PIIODevice
{