qf.h File Reference

QF/C++ platform-independent public interface. More...

#include "qs_port.h"

Go to the source code of this file.

Classes

class  QActive
 Base class for derivation of application-level active object classes. More...
class  QTimeEvt
 Time Event class. More...
class  QSubscrList
 Subscriber List class. More...
class  QF
 QF services. More...

Defines

#define Q_NEW(evtT_, sig_)   ((evtT_ *)QF::new_(sizeof(evtT_), (sig_)))
 Allocate a dynamic event.
#define QS_EQC_(ctr_)   QS::u8_(ctr_)
 Internal QS macro to output an unformatted event queue counter data element.

Variables

uint8_t const Q_ROM Q_ROM_VAR QF_log2Lkup [256]
 Lookup table for (log2(n) + 1), where n is the index into the table.
uint8_t const Q_ROM Q_ROM_VAR QF_pwr2Lkup [65]
 Lookup table for (1 << ((n-1) % 8)), where n is the index into the table.
uint8_t const Q_ROM Q_ROM_VAR QF_invPwr2Lkup [65]
 Lookup table for ~(1 << ((n-1) % 8)), where n is the index into the table.
uint8_t const Q_ROM Q_ROM_VAR QF_div8Lkup [65]
 Lookup table for (n-1)/8.

Detailed Description

QF/C++ platform-independent public interface.

This header file must be included directly or indirectly in all modules (*.cpp files) that use QF/C++.

Definition in file qf.h.


Define Documentation

#define Q_NEW ( evtT_,
sig_   )     ((evtT_ *)QF::new_(sizeof(evtT_), (sig_)))

Allocate a dynamic event.

This macro returns an event pointer cast to the type evtT_. The event is initialized with the signal sig. Internally, the macro calls the internal QF function QF::new_(), which always returns a valid event pointer.

Note:
The internal QF function QF::new_() raises an assertion when the allocation of the event turns out to be impossible due to event pool depletion, or incorrect (too big) size of the requested event.

The following example illustrates dynamic allocation of an event:

extern QActive *AO_Table;

QState Philosopher::hungry(Philosopher *me, QEvent const *e) {
    TableEvt *pe;
    switch (e->sig) {
        case Q_ENTRY_SIG: {
            pe = Q_NEW(TableEvt, HUNGRY_SIG);    // dynamically allocate event
            pe->philNum = me->num_;
            AO_Table->postFIFO(pe);               // post the event directly
            return Q_HANDLED();
        }
        . . .
    }
    return Q_SUPER(&QHsm::top);
}

Definition at line 876 of file qf.h.

#define QS_EQC_ ( ctr_   )     QS::u8_(ctr_)

Internal QS macro to output an unformatted event queue counter data element.

Note:
the counter size depends on the macro QF_EQUEUE_CTR_SIZE.

Definition at line 984 of file qf.h.

Referenced by QEQueue::get(), QActive::get_(), QEQueue::init(), QEQueue::postFIFO(), QActive::postFIFO(), QEQueue::postLIFO(), and QActive::postLIFO().


Variable Documentation

uint8_t const Q_ROM Q_ROM_VAR QF_div8Lkup[65]

Lookup table for (n-1)/8.

Note:
Index range n = 0..64. The first index (n == 0) should never be used.

Definition at line 59 of file qf_pwr2.cpp.

Referenced by QPSet64::hasElement(), QPSet64::insert(), QPSet64::remove(), QActive::subscribe(), QActive::unsubscribe(), and QActive::unsubscribeAll().

uint8_t const Q_ROM Q_ROM_VAR QF_invPwr2Lkup[65]

Lookup table for ~(1 << ((n-1) % 8)), where n is the index into the table.

Note:
Index range n = 0..64. The first index (n == 0) should never be used.

Definition at line 47 of file qf_pwr2.cpp.

Referenced by QF::publish(), QPSet64::remove(), QPSet8::remove(), QActive::unsubscribe(), and QActive::unsubscribeAll().

uint8_t const Q_ROM Q_ROM_VAR QF_log2Lkup[256]

Lookup table for (log2(n) + 1), where n is the index into the table.

This lookup delivers the 1-based number of the most significant 1-bit of a byte.

Note:
Index range n = 0..255. The first index (n == 0) should never be used.

Definition at line 35 of file qf_log2.cpp.

Referenced by QPSet64::findMax(), QPSet8::findMax(), and QF::publish().

uint8_t const Q_ROM Q_ROM_VAR QF_pwr2Lkup[65]

Lookup table for (1 << ((n-1) % 8)), where n is the index into the table.

Note:
Index range n = 0..64. The first index (n == 0) should never be used.

Definition at line 35 of file qf_pwr2.cpp.

Referenced by QPSet8::hasElement(), QPSet8::insert(), QActive::subscribe(), and QActive::unsubscribeAll().


Generated by  doxygen 1.6.2