pip static initializer

This commit is contained in:
2020-09-17 13:51:02 +03:00
parent 351ad1bf30
commit 5f7c58c28e
5 changed files with 133 additions and 106 deletions

View File

@@ -94,6 +94,25 @@
//! Macro is defined when PIP can use "rt" library for "PITimer::ThreadRT" timers implementation
# define PIP_TIMER_RT
//! Macro to declare private section, export is optional
# define PRIVATE_DECLARATION(export)
//! Macro to start definition of private section
# define PRIVATE_DEFINITION_START(Class)
//! Macro to end definition of private section
# define PRIVATE_DEFINITION_END(Class)
//! Macro to access private section by pointer
# define PRIVATE
//! Macro to start static initializer
# define STATIC_INITIALIZER_BEGIN
//! Macro to end static initializer
# define STATIC_INITIALIZER_END
#endif
#include <functional>
@@ -217,10 +236,29 @@
#define PRIVATE (__privateinitializer__.p)
#define PRIVATEWB __privateinitializer__.p
#define NO_COPY_CLASS(name) \
name(const name&) = delete; \
name& operator=(const name&) = delete;
#define _PIP_ADD_COUNTER_WS(a, cnt) a##cnt
#define _PIP_ADD_COUNTER_WF(a, cnt) _PIP_ADD_COUNTER_WS(a, cnt)
#define _PIP_ADD_COUNTER(a) _PIP_ADD_COUNTER_WF(a, __COUNTER__)
#define STATIC_INITIALIZER_BEGIN \
class { \
class _Initializer_ { \
public: \
_Initializer_() {
#define STATIC_INITIALIZER_END \
} \
} _initializer_; \
} _PIP_ADD_COUNTER(_pip_initializer_);
#ifdef FREERTOS
# define PIP_MIN_MSLEEP 10.
#else