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 QF_EVENT_SIZ_SIZE   2
 Default value of the macro configurable value in qf_port.h.
#define QF_ACTIVE_SUPER_   QHsm
 The macro defining the base class for QActive.
#define QF_ACTIVE_STATE_   QStateHandler
 The argument of the base class' constructor.
#define QF_TIMEEVT_CTR_SIZE   2
 macro to override the default QTimeEvtCtr size. Valid values 1, 2, or 4; default 2
#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 872 of file qf.h.

#define QF_ACTIVE_SUPER_   QHsm

The macro defining the base class for QActive.

By default, the QActive class is derived from QHsm. However, if the macro QF_ACTIVE_SUPER_ is defined, QActive is derived from QF_ACTIVE_SUPER_.

Clients might choose, for example, to define QF_ACTIVE_SUPER_ as QFsm to avoid the 1-2KB overhead of the hierarchical event processor.

Clients might also choose to define QF_ACTIVE_SUPER_ as their own completely customized class that has nothing to do with QHsm or QFsm. The QF_ACTIVE_SUPER_ class must provide member functions init() and dispatch(), consistent with the signatures of QHsm and QFsm. But the implementatin of these functions is completely open.

Definition at line 83 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 QPSet64::hasElement(), QPSet8::hasElement(), QPSet64::insert(), QPSet8::insert(), QActive::subscribe(), and QActive::unsubscribeAll().


Generated on Sat Nov 15 13:53:47 2008 for QP/C++ by  doxygen 1.5.4