threadedRead now const uchar *
pipacketextractor Header mode now more flexible fix splitTime mode more refactoring add virtual override to functions remove piforeach replace 0 to nullptr iterate over pimap via iterators replace CONNECTU to CONNECT# with compile time check
This commit is contained in:
@@ -30,9 +30,9 @@
|
||||
#include "pitimer.h"
|
||||
#include "piqueue.h"
|
||||
|
||||
|
||||
// function executed from threaded read, pass ThreadedReadData, readedData, sizeOfData
|
||||
typedef bool (*ReadRetFunc)(void * , uchar * , int );
|
||||
/// TODO: написать документацию, тут ничего не понятно
|
||||
// function executed from threaded read, pass readedData, sizeOfData, ThreadedReadData
|
||||
typedef bool (*ReadRetFunc)(const uchar *, int, void *);
|
||||
|
||||
|
||||
#ifdef DOXYGEN
|
||||
@@ -64,9 +64,9 @@ typedef bool (*ReadRetFunc)(void * , uchar * , int );
|
||||
|
||||
# define PIIODEVICE(name, prefix) \
|
||||
PIOBJECT_SUBCLASS(name, PIIODevice) \
|
||||
PIIODevice * copy() const {return new name();} \
|
||||
PIIODevice * copy() const override {return new name();} \
|
||||
public: \
|
||||
virtual PIConstChars fullPathPrefix() const {return prefix;} \
|
||||
virtual PIConstChars fullPathPrefix() const override {return prefix;} \
|
||||
static PIConstChars fullPathPrefixS() {return prefix;} \
|
||||
private:
|
||||
|
||||
@@ -239,7 +239,7 @@ public:
|
||||
|
||||
//! \~english Start threaded read and assign threaded read callback to "func"
|
||||
//! \~russian Запускает потоковое чтение и устанавливает callback потокового чтения в "func"
|
||||
void startThreadedRead(ReadRetFunc func) {ret_func_ = func; startThreadedRead();}
|
||||
void startThreadedRead(ReadRetFunc func) {func_read = func; startThreadedRead();}
|
||||
|
||||
//! \~english Stop threaded read. Hard stop terminate thread, otherwise wait fo 10 seconds
|
||||
//! \~russian Останавливает потоковое чтение. Жесткая остановка убивает поток, иначе ожидает 10 секунд
|
||||
@@ -369,7 +369,7 @@ public:
|
||||
|
||||
EVENT(opened);
|
||||
EVENT(closed);
|
||||
EVENT2(threadedReadEvent, uchar * , readed, int, size);
|
||||
EVENT2(threadedReadEvent, const uchar * , readed, int, size);
|
||||
EVENT2(threadedWriteEvent, ullong, id, int, written_size);
|
||||
|
||||
//! \handlers
|
||||
@@ -419,7 +419,7 @@ public:
|
||||
//! \~english Raise if succesfull close
|
||||
//! \~russian Вызывается при успешном закрытии
|
||||
|
||||
//! \fn void threadedReadEvent(uchar * readed, int size)
|
||||
//! \fn void threadedReadEvent(const uchar * readed, int size)
|
||||
//! \~english Raise if read thread succesfull read some data
|
||||
//! \~russian Вызывается при успешном потоковом чтении данных
|
||||
|
||||
@@ -475,7 +475,7 @@ protected:
|
||||
|
||||
//! \~english Function executed when thread read some data, default implementation execute external callback "ret_func_"
|
||||
//! \~russian Метод вызывается после каждого успешного потокового чтения, по умолчанию вызывает callback "ret_func_"
|
||||
virtual bool threadedRead(uchar * readed, int size);
|
||||
virtual bool threadedRead(const uchar * readed, int size);
|
||||
|
||||
//! \~english Reimplement to construct full unambiguous string, describes this device.
|
||||
//! Default implementation returns \a path()
|
||||
@@ -528,7 +528,7 @@ protected:
|
||||
|
||||
DeviceMode mode_;
|
||||
DeviceOptions options_;
|
||||
ReadRetFunc ret_func_;
|
||||
ReadRetFunc func_read;
|
||||
bool opened_;
|
||||
void * ret_data_;
|
||||
|
||||
@@ -539,9 +539,9 @@ private:
|
||||
virtual PIIODevice * copy() const {return 0;}
|
||||
PIString fullPathOptions() const;
|
||||
void _init();
|
||||
void begin();
|
||||
void run();
|
||||
void end() {terminate();}
|
||||
void begin() override;
|
||||
void run() override;
|
||||
void end() override {terminate();}
|
||||
static void cacheFullPath(const PIString & full_path, const PIIODevice * d);
|
||||
static PIMap<PIConstChars, FabricInfo> & fabrics();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user