QP/C++  5.8.2
macros.h File Reference

command-line macros and macros for porting QP More...

Go to the source code of this file.

Namespaces

 QP
 namespace associated with the QP/C++ framework
 

Macros

#define Q_NASSERT
 The preprocessor switch to disable checking assertions. More...
 
#define Q_EVT_CTOR
 The preprocessor switch to activate the event-constructors and destructors. More...
 
#define Q_SPY
 The preprocessor switch to activate the QS software tracing instrumentation in the code. More...
 
#define QF_OS_OBJECT_TYPE   uint8_t
 This macro defines the type of the OS-Object used for blocking the native QF event queue when the queue is empty. More...
 
#define QF_THREAD_TYPE   void *
 This macro defines the type of the thread handle used for the active objects. This macro depends on the QP port.
 
#define QACTIVE_EQUEUE_WAIT_(me_)   Q_ASSERT((me_)->m_eQueue.m_frontEvt != static_cast<QEvt const *>(0))
 Platform-dependent macro defining how QF should block the calling task when the QF native queue is empty. More...
 
#define QACTIVE_EQUEUE_SIGNAL_(me_)
 Platform-dependent macro defining how QF should signal the active object task that an event has just arrived. More...
 
#define QF_EPOOL_TYPE_   QMPool
 This macro defines the type of the event pool used in this QF port. More...
 
#define QF_EPOOL_INIT_(p_, poolSto_, poolSize_, evtSize_)   (p_).init((poolSto_), (poolSize_), static_cast<QMPoolSize>(evtSize_))
 Platform-dependent macro defining the event pool initialization. More...
 
#define QF_EPOOL_EVENT_SIZE_(p_)   static_cast<uint32_t>((p_).getBlockSize())
 Platform-dependent macro defining how QF should obtain the event pool block-size. More...
 
#define QF_EPOOL_GET_(p_, e_, m_)   ((e_) = static_cast<QEvt *>((p_).get((m_))))
 Platform-dependent macro defining how QF should obtain an event e_ from the event pool p_. More...
 
#define QF_EPOOL_PUT_(p_, e_)   ((p_).put(e_))
 Platform-dependent macro defining how QF should return an event e_ to the event pool p_. More...
 
#define WIN32_GUI
 Macro that should be defined (typically on the compiler's command line) in the Win32-GUI applications that use the Win32 API (Windows) or Win32-QV (Windows with QV) ports.
 

Detailed Description

command-line macros and macros for porting QP

Definition in file macros.h.

Macro Definition Documentation

◆ Q_EVT_CTOR

#define Q_EVT_CTOR

The preprocessor switch to activate the event-constructors and destructors.

When Q_EVT_CTOR is defined (typically in the qep_port.h header file), QP::QEvt becomes a class with constructor and virtual destructor. More importantly, the subclasses of QEvt (your custom events) can have non-default constructors and destructors. These constructors are then called when events are created (e.g., with Q_NEW()) and the destrucor is invoked before recycling the event with QP::QF::gc().

Definition at line 28 of file macros.h.

◆ Q_NASSERT

#define Q_NASSERT

The preprocessor switch to disable checking assertions.

When defined, Q_NASSERT disables the following macros Q_ASSERT, Q_REQUIRE, Q_ENSURE, Q_INVARIANT, Q_ERROR as well as Q_ASSERT_ID, Q_REQUIRE_ID, Q_ENSURE_ID, Q_INVARIANT_ID, and Q_ERROR_ID do NOT evaluate the test condition passed as the argument to these macros.

Note
One notable exception is the macro Q_ALLEGE, that still evaluates the test condition, but does not report assertion failures when the switch Q_NASSERT is defined.

Definition at line 17 of file macros.h.

◆ Q_SPY

#define Q_SPY

The preprocessor switch to activate the QS software tracing instrumentation in the code.

When defined, Q_SPY activates the QS software tracing instrumentation. When Q_SPY is not defined, the QS instrumentation in the code does not generate any code.

Definition at line 36 of file macros.h.

◆ QACTIVE_EQUEUE_SIGNAL_

#define QACTIVE_EQUEUE_SIGNAL_ (   me_)
Value:
do { \
QK_readySet_.insert((me_)->m_prio); \
if (QK_intNest_ == static_cast<uint8_t>(0)) { \
uint8_t p = QK_schedPrio_(); \
if (p != static_cast<uint8_t>(0)) { \
QK_sched_(p); \
} \
} \
} while (false)

Platform-dependent macro defining how QF should signal the active object task that an event has just arrived.

The macro is necessary only when the native QF event queue is used. The signaling of task involves unblocking the task if it is blocked.

Note
QACTIVE_EQUEUE_SIGNAL_ is called from a critical section. It might leave the critical section internally, but must restore the critical section before exiting to the caller.
This is just an example of QACTIVE_EQUEUE_SIGNAL_ for the QK-port of QF. In other QF ports you need to define the macro appropriately for the underlying kernel/OS you're using.

Definition at line 79 of file macros.h.

◆ QACTIVE_EQUEUE_WAIT_

#define QACTIVE_EQUEUE_WAIT_ (   me_)    Q_ASSERT((me_)->m_eQueue.m_frontEvt != static_cast<QEvt const *>(0))

Platform-dependent macro defining how QF should block the calling task when the QF native queue is empty.

Note
This is just an example of QACTIVE_EQUEUE_WAIT_ for the QK-port of QF. QK never activates a task that has no events to process, so in this case the macro asserts that the queue is not empty. In other QF ports you using.

Definition at line 63 of file macros.h.

◆ QF_EPOOL_EVENT_SIZE_

#define QF_EPOOL_EVENT_SIZE_ (   p_)    static_cast<uint32_t>((p_).getBlockSize())

Platform-dependent macro defining how QF should obtain the event pool block-size.

Note
This is a specific implementation for the QK-port of QF. In other QF ports you need to define the macro appropriately for the underlying kernel/OS you're using.

Definition at line 110 of file macros.h.

◆ QF_EPOOL_GET_

#define QF_EPOOL_GET_ (   p_,
  e_,
  m_ 
)    ((e_) = static_cast<QEvt *>((p_).get((m_))))

Platform-dependent macro defining how QF should obtain an event e_ from the event pool p_.

Note
This is a specific implementation for the QK-port of QF. In other QF ports you need to define the macro appropriately for the underlying kernel/OS you're using.

Definition at line 118 of file macros.h.

◆ QF_EPOOL_INIT_

#define QF_EPOOL_INIT_ (   p_,
  poolSto_,
  poolSize_,
  evtSize_ 
)    (p_).init((poolSto_), (poolSize_), static_cast<QMPoolSize>(evtSize_))

Platform-dependent macro defining the event pool initialization.

Note
This is a specific implementation for the QK-port of QF. In other QF ports you need to define the macro appropriately for the underlying kernel/OS you're using.

Definition at line 101 of file macros.h.

◆ QF_EPOOL_PUT_

#define QF_EPOOL_PUT_ (   p_,
  e_ 
)    ((p_).put(e_))

Platform-dependent macro defining how QF should return an event e_ to the event pool p_.

Note
This is a specific implementation for the QK-port of QF. In other QF ports you need to define the macro appropriately for the underlying kernel/OS you're using.

Definition at line 127 of file macros.h.

◆ QF_EPOOL_TYPE_

#define QF_EPOOL_TYPE_   QMPool

This macro defines the type of the event pool used in this QF port.

Note
This is a specific implementation for the QK-port of QF. In other QF ports you need to define the macro appropriately for the underlying kernel/OS you're using.

Definition at line 94 of file macros.h.

◆ QF_OS_OBJECT_TYPE

#define QF_OS_OBJECT_TYPE   uint8_t

This macro defines the type of the OS-Object used for blocking the native QF event queue when the queue is empty.

In QK, the OS object is used to hold the per-thread flags, which might be used, for example, to remember the thread attributes (e.g., if the thread uses a floating point co-processor). The OS object value is set on per-thread basis in QActive::start(). Later, the extended context switch macros (QK_EXT_SAVE() and QK_EXT_RESTORE()) might use the per-thread flags to determine what kind of extended context switch this particular thread needs (e.g., the thread might not be using the coprocessor or might be using a different one).

Definition at line 49 of file macros.h.