#15 убрать PIP_CXX11_SUPPORT

This commit is contained in:
2020-07-17 11:51:30 +03:00
parent 33a6382f4d
commit b772928dc1
11 changed files with 8 additions and 92 deletions

View File

@@ -26,11 +26,7 @@
#include "pithread.h"
#include "pitime.h"
#ifdef PIP_CXX11_SUPPORT
typedef std::function<void(void *, int)> TimerEvent;
#else
typedef void (*TimerEvent)(void *, int);
#endif
class PITimer;
@@ -97,13 +93,11 @@ public:
//! \brief Constructs timer with "slot" slot void(void *,int), "data" data and "ti" implementation
explicit PITimer(TimerEvent slot, void * data = 0, TimerImplementation ti = Thread);
#ifdef PIP_CXX11_SUPPORT
//! \brief Constructs timer with "slot" slot void(), and "ti" implementation
explicit PITimer(std::function<void ()> slot, TimerImplementation ti = Thread);
//! \brief Constructs timer with "slot" slot void(void *), "data" data and "ti" implementation
explicit PITimer(std::function<void (void *)> slot, void * data, TimerImplementation ti = Thread);
#endif
virtual ~PITimer();
@@ -160,13 +154,11 @@ public:
//! \brief Set timer tick function
void setSlot(TimerEvent slot) {ret_func = slot;}
#ifdef PIP_CXX11_SUPPORT
//! \brief Set timer tick function
void setSlot(std::function<void ()> slot) {ret_func = [slot](void *, int){slot();};}
//! \brief Set timer tick function
void setSlot(std::function<void (void *)> slot) {ret_func = [slot](void *d, int){slot(d);};}
#endif
//! \brief Returns common data passed to tick functions
void * data() const {return data_t;}
@@ -186,13 +178,11 @@ public:
//! \brief Add frequency delimiter \b delim with optional delimiter slot \b slot.
void addDelimiter(int delim, TimerEvent slot = 0) {delims << Delimiter(slot, delim);}
#ifdef PIP_CXX11_SUPPORT
//! \brief Add frequency delimiter \b delim with optional delimiter slot \b slot.
void addDelimiter(int delim, std::function<void ()> slot) {delims << Delimiter([slot](void *, int){slot();}, delim);}
//! \brief Add frequency delimiter \b delim with optional delimiter slot \b slot.
void addDelimiter(int delim, std::function<void (void *)> slot) {delims << Delimiter([slot](void *d, int){slot(d);}, delim);}
#endif
//! \brief Remove all frequency delimiters \b delim.
void removeDelimiter(int delim) {for (int i = 0; i < delims.size_s(); ++i) if (delims[i].delim == delim) {delims.remove(i); i--;}}