QP/C++ 6.9.3
qf.hpp
Go to the documentation of this file.
1 
39 #ifndef QF_HPP
40 #define QF_HPP
41 
42 //****************************************************************************
43 #ifndef QPSET_HPP
44 #include "qpset.hpp"
45 #endif
46 
47 #ifdef Q_EVT_CTOR
48 #include <new> // for placement new
49 #endif // Q_EVT_CTOR
50 
51 //****************************************************************************
52 // apply defaults for all undefined configuration parameters
53 //
54 #ifndef QF_EVENT_SIZ_SIZE
56  #define QF_EVENT_SIZ_SIZE 2U
57 #endif
58 
59 #ifndef QF_MAX_EPOOL
61  #define QF_MAX_EPOOL 3U
62 #endif
63 
64 #ifndef QF_MAX_TICK_RATE
67  #define QF_MAX_TICK_RATE 1U
68 #elif (QF_MAX_TICK_RATE > 15U)
69  #error "QF_MAX_TICK_RATE exceeds the maximum of 15U"
70 #endif
71 
72 #ifndef QF_TIMEEVT_CTR_SIZE
75  #define QF_TIMEEVT_CTR_SIZE 2U
76 #endif
77 
78 
79 //****************************************************************************
80 namespace QP {
81 
82 #if (QF_EVENT_SIZ_SIZE == 1U)
84 #elif (QF_EVENT_SIZ_SIZE == 2U)
90  using QEvtSize = std::uint16_t;
91 #elif (QF_EVENT_SIZ_SIZE == 4U)
92  using QEvtSize = std::uint32_t;
93 #else
94  #error "QF_EVENT_SIZ_SIZE defined incorrectly, expected 1U, 2U, or 4U"
95 #endif
96 
97 //****************************************************************************
98 #if (QF_TIMEEVT_CTR_SIZE == 1U)
100 #elif (QF_TIMEEVT_CTR_SIZE == 2U)
109  using QTimeEvtCtr = std::uint16_t;
110 #elif (QF_TIMEEVT_CTR_SIZE == 4U)
111  using QTimeEvtCtr = std::uint32_t;
112 #else
113  #error "QF_TIMEEVT_CTR_SIZE defined incorrectly, expected 1U, 2U, or 4U"
114 #endif
115 
116 class QEQueue; // forward declaration
117 
118 //****************************************************************************
144 class QActive : public QHsm {
145 public: // for access from extern "C" functions
146 #ifdef QF_EQUEUE_TYPE
157  QF_EQUEUE_TYPE m_eQueue;
158 #endif
159 
160 #ifdef QF_OS_OBJECT_TYPE
167  QF_OS_OBJECT_TYPE m_osObject;
168 #endif
169 
170 #ifdef QF_THREAD_TYPE
176  QF_THREAD_TYPE m_thread;
177 #endif
178 
179 #ifdef QXK_HPP // QXK kernel used?
181  std::uint8_t m_dynPrio;
182 #endif
183 
186 
187 protected:
189  QActive(QStateHandler const initial) noexcept;
190 
191 public:
194  virtual void start(std::uint_fast8_t const prio,
195  QEvt const * * const qSto, std::uint_fast16_t const qLen,
196  void * const stkSto, std::uint_fast16_t const stkSize,
197  void const * const par);
198 
200  virtual void start(std::uint_fast8_t const prio,
201  QEvt const * * const qSto, std::uint_fast16_t const qLen,
202  void * const stkSto, std::uint_fast16_t const stkSize)
203  {
204  this->start(prio, qSto, qLen, stkSto, stkSize, nullptr);
205  }
206 
207 #ifdef QF_ACTIVE_STOP
215  void stop(void);
216 #endif
217 
218 #ifndef Q_SPY
221  virtual bool post_(QEvt const * const e,
222  std::uint_fast16_t const margin) noexcept;
223 #else
224  virtual bool post_(QEvt const * const e, std::uint_fast16_t const margin,
225  void const * const sender) noexcept;
226 #endif
227 
230  virtual void postLIFO(QEvt const * const e) noexcept;
231 
233  void unsubscribeAll(void) const noexcept;
234 
236  void subscribe(enum_t const sig) const noexcept;
237 
239  void unsubscribe(enum_t const sig) const noexcept;
240 
242  bool defer(QEQueue * const eq, QEvt const * const e) const noexcept;
243 
245  bool recall(QEQueue * const eq) noexcept;
246 
248  std::uint_fast16_t flushDeferred(QEQueue * const eq) const noexcept;
249 
251  std::uint_fast8_t getPrio(void) const noexcept {
252  return static_cast<std::uint_fast8_t>(m_prio);
253  }
254 
256  void setPrio(std::uint_fast8_t const prio) {
257  m_prio = static_cast<std::uint8_t>(prio);
258  }
259 
261  void setAttr(std::uint32_t attr1, void const *attr2 = nullptr);
262 
263 #ifdef QF_OS_OBJECT_TYPE
266  QF_OS_OBJECT_TYPE &getOsObject(void) noexcept { return m_osObject; }
267 #endif
268 
269 #ifdef QF_THREAD_TYPE
272  QF_THREAD_TYPE &getThread(void) noexcept { return m_thread; }
273 #endif
274 
276  QEvt const *get_(void) noexcept;
277 
278 // duplicated API to be used exclusively inside ISRs (useful in some QP ports)
279 #ifdef QF_ISR_API
280 #ifdef Q_SPY
281  virtual bool postFromISR_(QEvt const * const e,
282  std::uint_fast16_t const margin, void *par,
283  void const * const sender) noexcept;
284 #else
285  virtual bool postFromISR_(QEvt const * const e,
286  std::uint_fast16_t const margin, void *par) noexcept;
287 #endif // Q_SPY
288 #endif // QF_ISR_API
289 
290 // friendships...
291 private:
292  friend class QF;
293  friend class QTimeEvt;
294  friend class QTicker;
295 #ifdef QK_HPP
296  friend class QMutex;
297 #endif // QK_HPP
298 #ifdef QXK_HPP
299  friend class QXK;
300  friend class QXThread;
301  friend class QXMutex;
302  friend class QXSemaphore;
303 #endif // QXK_HPP
304 #ifdef Q_UTEST
305  friend class QActiveDummy;
306 #endif // Q_UTEST
307 };
308 
309 //****************************************************************************
330 class QMActive : public QActive {
331 public:
332  // all the following operations delegate to the QHsm class...
333  void init(void const * const e,
334  std::uint_fast8_t const qs_id) override;
335  void init(std::uint_fast8_t const qs_id) override;
336  void dispatch(QEvt const * const e,
337  std::uint_fast8_t const qs_id) override;
338 
339 #ifdef Q_SPY
341  QStateHandler getStateHandler() noexcept override;
342 #endif
343 
345  bool isInState(QMState const * const st) const noexcept;
346 
348  QMState const *stateObj(void) const noexcept {
349  return m_state.obj;
350  }
351 
353  QMState const *childStateObj(QMState const * const parent) const noexcept;
354 
355 protected:
357  QMActive(QStateHandler const initial) noexcept;
358 
359 private:
361  using QHsm::isIn;
362  using QHsm::state;
363  using QHsm::childState;
364 };
365 
366 
367 //****************************************************************************
404 class QTimeEvt : public QEvt {
405 private:
406 
408  QTimeEvt * volatile m_next;
409 
414  void * volatile m_act;
415 
421  QTimeEvtCtr volatile m_ctr;
422 
430 
431 public:
432 
434  QTimeEvt(QActive * const act, enum_t const sgnl,
435  std::uint_fast8_t const tickRate = 0U) noexcept;
436 
438  void armX(QTimeEvtCtr const nTicks,
439  QTimeEvtCtr const interval = 0U) noexcept;
440 
442  bool disarm(void) noexcept;
443 
445  bool rearm(QTimeEvtCtr const nTicks) noexcept;
446 
448  bool wasDisarmed(void) noexcept;
449 
451  QTimeEvtCtr currCtr(void) const noexcept;
452 
453 private:
455  QTimeEvt(void) noexcept;
456 
458  QTimeEvt(QTimeEvt const &) = delete;
459 
461  QTimeEvt & operator=(QTimeEvt const &) = delete;
462 
464  QActive *toActive(void) noexcept {
465  return static_cast<QActive *>(m_act);
466  }
467 
469  QTimeEvt *toTimeEvt(void) noexcept {
470  return static_cast<QTimeEvt *>(m_act);
471  }
472 
473  friend class QF;
474  friend class QS;
475 #ifdef QXK_HPP
476  friend class QXThread;
477  friend void QXK_activate_(void);
478 #endif // QXK_HPP
479 };
480 
481 
482 //****************************************************************************
489 
490 
491 //****************************************************************************
496 class QF {
497 public:
498 
500  static char_t const *getVersion(void) noexcept {
501  return versionStr;
502  }
503 
505  static void init(void);
506 
508  static void psInit(QSubscrList * const subscrSto,
509  enum_t const maxSignal) noexcept;
510 
512  static void poolInit(void * const poolSto,
513  std::uint_fast32_t const poolSize,
514  std::uint_fast16_t const evtSize) noexcept;
515 
517  static std::uint_fast16_t poolGetMaxBlockSize(void) noexcept;
518 
519 
521  static int_t run(void);
522 
524  static void onStartup(void);
525 
527  static void onCleanup(void);
528 
531  static void stop(void);
532 
533 #ifndef Q_SPY
534  static void publish_(QEvt const * const e) noexcept;
535  static void tickX_(std::uint_fast8_t const tickRate) noexcept;
536 #else
538  static void publish_(QEvt const * const e,
539  void const * const sender,
540  std::uint_fast8_t const qs_id) noexcept;
541 
543  static void tickX_(std::uint_fast8_t const tickRate,
544  void const * const sender) noexcept;
545 #endif // Q_SPY
546 
549  static bool noTimeEvtsActiveX(std::uint_fast8_t const tickRate) noexcept;
550 
553  static std::uint_fast16_t getPoolMin(std::uint_fast8_t const poolId)
554  noexcept;
555 
559  noexcept;
560 
562  static QEvt *newX_(std::uint_fast16_t const evtSize,
563  std::uint_fast16_t const margin,
564  enum_t const sig) noexcept;
565 
567  static void gc(QEvt const * const e) noexcept;
568 
570  static QEvt const *newRef_(QEvt const * const e,
571  QEvt const * const evtRef) noexcept;
572 
574  static void deleteRef_(QEvt const * const evtRef) noexcept;
575 
577  static void remove_(QActive * const a) noexcept;
578 
581 
583  static void thread_(QActive *act);
584 
586  static void add_(QActive * const a) noexcept;
587 
589  static void bzero(void * const start,
590  std::uint_fast16_t const len) noexcept;
591 
592 // API to be used exclusively inside ISRs (useful in some QP ports)
593 #ifdef QF_ISR_API
594 #ifdef Q_SPY
595  static void publishFromISR_(QEvt const *e, void *par,
596  void const *sender) noexcept;
597  static void tickXfromISR_(std::uint_fast8_t const tickRate, void *par,
598  void const * const sender) noexcept;
599 #else
600  static void publishFromISR_(QEvt const *e, void *par) noexcept;
601  static void tickXfromISR_(std::uint_fast8_t const tickRate,
602  void *par) noexcept;
603 #endif // Q_SPY
604 
605  static QEvt *newXfromISR_(std::uint_fast16_t const evtSize,
606  std::uint_fast16_t const margin,
607  enum_t const sig) noexcept;
608  static void gcFromISR(QEvt const *e) noexcept;
609 
610 #endif // QF_ISR_API
611 
612 // to be used in QF ports only...
613 private:
615  static QTimeEvt timeEvtHead_[QF_MAX_TICK_RATE];
616 
617  friend class QActive;
618  friend class QTimeEvt;
619  friend class QS;
620 #ifdef QXK_HPP
621  friend class QXThread;
622 #endif // QXK_HPP
623 };
624 
628 
629 
630 //****************************************************************************
640 class QTicker : public QActive {
641 public:
642  explicit QTicker(std::uint_fast8_t const tickRate) noexcept; // ctor
643 
644  void init(void const * const e,
645  std::uint_fast8_t const qs_id) noexcept override;
646  void init(std::uint_fast8_t const qs_id) noexcept override {
647  this->init(qs_id);
648  }
649  void dispatch(QEvt const * const e,
650  std::uint_fast8_t const qs_id) noexcept override;
651 #ifndef Q_SPY
652  bool post_(QEvt const * const e,
653  std::uint_fast16_t const margin) noexcept override;
654 #else
655  bool post_(QEvt const * const e, std::uint_fast16_t const margin,
656  void const * const sender) noexcept override;
657 #endif
658  void postLIFO(QEvt const * const e) noexcept override;
659 };
660 
661 } // namespace QP
662 
663 //****************************************************************************
664 #ifndef QF_CRIT_EXIT_NOP
674  #define QF_CRIT_EXIT_NOP() (static_cast<void>(0))
675 #endif
676 
677 //****************************************************************************
678 // Provide the constructor for the QEvt class?
679 #ifdef Q_EVT_CTOR
680 
681  #define Q_NEW(evtT_, sig_, ...) \
682  (new(QP::QF::newX_(sizeof(evtT_), QP::QF_NO_MARGIN, 0)) \
683  evtT_((sig_), ##__VA_ARGS__))
684 
685  #define Q_NEW_X(e_, evtT_, margin_, sig_, ...) do { \
686  (e_) = static_cast<evtT_ *>( \
687  QP::QF::newX_(sizeof(evtT_), (margin_), 0)); \
688  if ((e_) != nullptr) { \
689  new((e_)) evtT_((sig_), ##__VA_ARGS__); \
690  } \
691  } while (false)
692 
693 #else // QEvt is a POD (Plain Old Datatype)
694 
715  #define Q_NEW(evtT_, sig_) (static_cast<evtT_ *>( \
716  QP::QF::newX_(sizeof(evtT_), QP::QF_NO_MARGIN, (sig_))))
717 
743  #define Q_NEW_X(e_, evtT_, margin_, sig_) \
744  ((e_) = static_cast<evtT_ *>(QP::QF::newX_( \
745  sizeof(evtT_), (margin_), (sig_))))
746 #endif
747 
767 #define Q_NEW_REF(evtRef_, evtT_) \
768  ((evtRef_) = static_cast<evtT_ const *>(QP::QF::newRef_(e, (evtRef_))))
769 
784 #define Q_DELETE_REF(evtRef_) do { \
785  QP::QF::deleteRef_((evtRef_)); \
786  (evtRef_) = 0U; \
787 } while (false)
788 
789 
790 //****************************************************************************
791 // QS software tracing integration, only if enabled
792 #ifdef Q_SPY
793 
816  #define TICK_X(tickRate_, sender_) tickX_((tickRate_), (sender_))
817 
839  #define PUBLISH(e_, sender_) \
840  publish_((e_), (sender_), (sender_)->getPrio())
841 
862  #define POST(e_, sender_) post_((e_), QP::QF_NO_MARGIN, (sender_))
863 
896  #define POST_X(e_, margin_, sender_) \
897  post_((e_), (margin_), (sender_))
898 
899 #else
900 
901  #define PUBLISH(e_, dummy_) publish_((e_))
902  #define POST(e_, dummy_) post_((e_), QP::QF_NO_MARGIN)
903  #define POST_X(e_, margin_, dummy_) post_((e_), (margin_))
904  #define TICK_X(tickRate_, dummy_) tickX_((tickRate_))
905 
906 #endif // Q_SPY
907 
910 #define TICK(sender_) TICK_X(0U, (sender_))
911 
912 #endif // QF_HPP
913 
unsigned int uint16_t
exact-width 16-bit unsigned int
Definition: 16bit/stdint.h:30
unsigned int uint_fast16_t
fast at-least 16-bit unsigned int
Definition: 16bit/stdint.h:38
unsigned long int uint32_t
exact-width 32-bit unsigned int
Definition: 16bit/stdint.h:31
unsigned char uint8_t
exact-width 8-bit unsigned int
Definition: 16bit/stdint.h:29
unsigned int uint_fast8_t
fast at-least 8-bit unsigned int
Definition: 16bit/stdint.h:36
unsigned long uint_fast32_t
fast at-least 32-bit unsigned int
Definition: 16bit/stdint.h:40
Dummy Active Object class.
Definition: qs.hpp:620
QActive active object (based on QP::QHsm implementation)
Definition: qf.hpp:144
std::uint8_t m_prio
QF priority (1..QF_MAX_ACTIVE) of this active object.
Definition: qf.hpp:185
void setAttr(std::uint32_t attr1, void const *attr2=nullptr)
Generic setting of additional attributes (useful in QP ports)
friend class QTicker
Definition: qf.hpp:294
virtual void postLIFO(QEvt const *const e) noexcept
Posts an event directly to the event queue of the active object using the Last-In-First-Out (LIFO) po...
Definition: qf_actq.cpp:228
virtual void start(std::uint_fast8_t const prio, QEvt const **const qSto, std::uint_fast16_t const qLen, void *const stkSto, std::uint_fast16_t const stkSize)
Overloaded start function (no initialization event)
Definition: qf.hpp:200
bool defer(QEQueue *const eq, QEvt const *const e) const noexcept
Defer an event to a given separate event queue.
Definition: qf_defer.cpp:77
virtual bool post_(QEvt const *const e, std::uint_fast16_t const margin, void const *const sender) noexcept
Definition: qf_actq.cpp:90
void unsubscribeAll(void) const noexcept
Un-subscribes from the delivery of all signals to the active object.
Definition: qf_ps.cpp:293
void subscribe(enum_t const sig) const noexcept
Subscribes for delivery of signal sig to the active object.
Definition: qf_ps.cpp:204
std::uint_fast8_t getPrio(void) const noexcept
Get the priority of the active object.
Definition: qf.hpp:251
bool recall(QEQueue *const eq) noexcept
Recall a deferred event from a given event queue.
Definition: qf_defer.cpp:113
void stop(void)
Stops execution of an active object and removes it from the framework's supervision.
Definition: qutest.cpp:112
virtual void start(std::uint_fast8_t const prio, QEvt const **const qSto, std::uint_fast16_t const qLen, void *const stkSto, std::uint_fast16_t const stkSize, void const *const par)
Starts execution of an active object and registers the object with the framework.
Definition: qk.cpp:173
std::uint_fast16_t flushDeferred(QEQueue *const eq) const noexcept
Flush the specified deferred queue 'eq'.
Definition: qf_defer.cpp:178
void unsubscribe(enum_t const sig) const noexcept
Un-subscribes from the delivery of signal sig to the active object.
Definition: qf_ps.cpp:248
QEvt const * get_(void) noexcept
Get an event from the event queue of an active object.
Definition: qf_actq.cpp:313
void setPrio(std::uint_fast8_t const prio)
Set the priority of the active object.
Definition: qf.hpp:256
Native QF Event Queue class.
Definition: qequeue.hpp:123
QF services.
Definition: qf.hpp:496
static std::uint_fast16_t getPoolMin(std::uint_fast8_t const poolId) noexcept
This function returns the minimum of free entries of the given event pool.
Definition: qf_mem.cpp:303
static void onStartup(void)
Startup QF callback.
static void psInit(QSubscrList *const subscrSto, enum_t const maxSignal) noexcept
Publish-subscribe initialization.
Definition: qf_ps.cpp:89
static std::uint_fast16_t getQueueMin(std::uint_fast8_t const prio) noexcept
This function returns the minimum of free entries of the given event queue.
Definition: qf_actq.cpp:378
static void init(void)
QF initialization.
Definition: qk.cpp:78
static void onCleanup(void)
Cleanup QF callback.
static void thread_(QActive *act)
Thread routine for executing an active object act.
static bool noTimeEvtsActiveX(std::uint_fast8_t const tickRate) noexcept
Returns true if all time events are inactive and false any time event is active.
Definition: qf_time.cpp:206
static int_t run(void)
Transfers control to QF to run the application.
Definition: qk.cpp:137
static char_t const * getVersion(void) noexcept
get the current QF version number string of the form X.Y.Z
Definition: qf.hpp:500
static QTimeEvt timeEvtHead_[QF_MAX_TICK_RATE]
heads of linked lists of time events, one for every clock tick rate
Definition: qf.hpp:615
static void gc(QEvt const *const e) noexcept
Recycle a dynamic event.
Definition: qf_dyn.cpp:219
static void deleteRef_(QEvt const *const evtRef) noexcept
Internal QF implementation of deleting event reference.
Definition: qf_dyn.cpp:327
static QEvt * newX_(std::uint_fast16_t const evtSize, std::uint_fast16_t const margin, enum_t const sig) noexcept
Internal QF implementation of creating new dynamic event.
Definition: qf_dyn.cpp:140
static void bzero(void *const start, std::uint_fast16_t const len) noexcept
Clear a specified region of memory to zero.
Definition: qf_act.cpp:129
static void add_(QActive *const a) noexcept
Register an active object to be managed by the framework.
Definition: qf_act.cpp:79
static void stop(void)
Function invoked by the application layer to stop the QF application and return control to the OS/Ker...
Definition: qk.cpp:111
static QActive * active_[QF_MAX_ACTIVE+1U]
array of registered active objects
Definition: qf.hpp:580
static std::uint_fast16_t poolGetMaxBlockSize(void) noexcept
Obtain the block size of any registered event pools.
Definition: qf_dyn.cpp:345
static void remove_(QActive *const a) noexcept
Remove the active object from the framework.
Definition: qf_act.cpp:103
static void poolInit(void *const poolSto, std::uint_fast32_t const poolSize, std::uint_fast16_t const evtSize) noexcept
Event pool initialization for dynamic allocation of events.
Definition: qf_dyn.cpp:84
static QEvt const * newRef_(QEvt const *const e, QEvt const *const evtRef) noexcept
Internal QF implementation of creating new event reference.
Definition: qf_dyn.cpp:291
static void tickX_(std::uint_fast8_t const tickRate, void const *const sender) noexcept
Processes all armed time events at every clock tick.
Definition: qf_time.cpp:78
static void publish_(QEvt const *const e, void const *const sender, std::uint_fast8_t const qs_id) noexcept
Publish event to the framework.
Definition: qf_ps.cpp:121
Hierarchical State Machine base class.
Definition: qep.hpp:269
friend class QActive
Definition: qep.hpp:470
QStateHandler childState(QStateHandler const parent) noexcept
Obtain the current active child state of a given parent.
Definition: qep_hsm.cpp:600
QHsmAttr m_state
current active state (state-variable)
Definition: qep.hpp:270
QStateHandler state(void) const noexcept
Obtain the current state (state handler function)
Definition: qep.hpp:296
bool isIn(QStateHandler const s) noexcept
Tests if a given state is part of the current active state configuration.
Definition: qep_hsm.cpp:557
friend class QMActive
Definition: qep.hpp:471
QMActive active object (based on QP::QMsm implementation)
Definition: qf.hpp:330
QStateHandler getStateHandler() noexcept override
Get the current state handler of the QMsm.
Definition: qf_qmact.cpp:94
QMState const * stateObj(void) const noexcept
Return the current active state object (read only)
Definition: qf.hpp:348
void dispatch(QEvt const *const e, std::uint_fast8_t const qs_id) override
Dispatches an event to QHsm.
Definition: qf_qmact.cpp:77
QMState const * childStateObj(QMState const *const parent) const noexcept
Obtain the current active child state of a given parent (read only)
Definition: qf_qmact.cpp:86
void init(void const *const e, std::uint_fast8_t const qs_id) override
executes the top-most initial transition in QP::QHsm
Definition: qf_qmact.cpp:68
bool isInState(QMState const *const st) const noexcept
Tests if a given state is part of the active state configuration.
Definition: qf_qmact.cpp:82
QS logging facilities.
Definition: qs.hpp:302
Ticker Active Object class.
Definition: qf.hpp:640
void init(void const *const e, std::uint_fast8_t const qs_id) noexcept override
executes the top-most initial transition in QP::QHsm
Definition: qf_actq.cpp:400
void postLIFO(QEvt const *const e) noexcept override
Posts an event directly to the event queue of the active object using the Last-In-First-Out (LIFO) po...
Definition: qf_actq.cpp:474
void init(std::uint_fast8_t const qs_id) noexcept override
overloaded init(qs_id)
Definition: qf.hpp:646
bool post_(QEvt const *const e, std::uint_fast16_t const margin, void const *const sender) noexcept override
Definition: qf_actq.cpp:430
void dispatch(QEvt const *const e, std::uint_fast8_t const qs_id) noexcept override
Dispatches an event to QHsm.
Definition: qf_actq.cpp:408
Time Event class.
Definition: qf.hpp:404
QTimeEvt * toTimeEvt(void) noexcept
encapsulate the cast the m_act attribute to QTimeEvt*
Definition: qf.hpp:469
QTimeEvtCtr currCtr(void) const noexcept
Get the current value of the down-counter of a time event.
Definition: qf_time.cpp:560
QTimeEvtCtr volatile m_ctr
the internal down-counter of the time event.
Definition: qf.hpp:421
QActive * toActive(void) noexcept
encapsulate the cast the m_act attribute to QActive*
Definition: qf.hpp:464
QTimeEvtCtr m_interval
the interval for the periodic time event (zero for the one-shot time event).
Definition: qf.hpp:429
QTimeEvt(void) noexcept
private default constructor only for friends
Definition: qf_time.cpp:268
QTimeEvt *volatile m_next
link to the next time event in the list
Definition: qf.hpp:408
QTimeEvt(QTimeEvt const &)=delete
private copy constructor to disallow copying of QTimeEvts
void armX(QTimeEvtCtr const nTicks, QTimeEvtCtr const interval=0U) noexcept
Arm a time event (one shot or periodic) for event posting.
Definition: qf_time.cpp:324
QTimeEvt & operator=(QTimeEvt const &)=delete
private assignment operator to disallow assigning of QTimeEvts
bool disarm(void) noexcept
Disarm a time event.
Definition: qf_time.cpp:400
bool wasDisarmed(void) noexcept
Check the "was disarmed" status of a time event.
Definition: qf_time.cpp:541
bool rearm(QTimeEvtCtr const nTicks) noexcept
Rearm a time event.
Definition: qf_time.cpp:460
void *volatile m_act
the active object that receives the time events
Definition: qf.hpp:414
QXK services.
Definition: qxk.hpp:144
Priority Ceiling Mutex the QXK preemptive kernel.
Definition: qxthread.hpp:210
Counting Semaphore of the QXK preemptive kernel.
Definition: qxthread.hpp:153
Extended (blocking) thread of the QXK preemptive kernel.
Definition: qxthread.hpp:66
#define QF_OS_OBJECT_TYPE
This macro defines the type of the OS-Object used for blocking.
Definition: macros.hpp:61
#define QF_THREAD_TYPE
This macro defines the type of the thread handle used for AOs.
Definition: macros.hpp:46
#define QF_EQUEUE_TYPE
This macro defines the type of the event-queue used for AOs.
Definition: macros.hpp:49
namespace associated with the QP/C++ framework
Definition: struct.dox:1
std::uint_fast16_t const QF_NO_MARGIN
special value of margin that causes asserting failure in case event allocation or event posting fails
Definition: qf.hpp:627
QMState const * obj
pointer to QMState object
Definition: qep.hpp:242
constexpr char_t const versionStr[]
the current QP version number string based on QP_VERSION_STR
Definition: qep.hpp:133
std::uint8_t QEvtSize
Definition: qf.hpp:83
std::uint8_t QTimeEvtCtr
Definition: qf.hpp:99
QState(*)(void *const me, QEvt const *const e) QStateHandler
Pointer to state-handler function.
Definition: qep.hpp:226
State object for the QP::QMsm class (QM State Machine).
Definition: qep.hpp:584
char char_t
typedef for character strings.
Definition: qassert.h:77
int int_t
typedef for assertions-ids and line numbers in assertions.
Definition: qassert.h:86
int enum_t
alias for enumerations used for event signals
Definition: qep.hpp:82
platform-independent priority sets of 8 or 64 elements.
#define QF_MAX_ACTIVE
The maximum number of active objects in the application.
Definition: qxk/qf_port.hpp:57
void QXK_activate_(void)
QXK activator activates the next active object. The activated AO preempts.
Definition: qxk.cpp:423
QEvt base class.
Definition: qep.hpp:209
Priority Set of up to 32 elements *‍/.
Definition: qpset.hpp:76