QP/C++
Classes | Defines | Typedefs
qevent.h File Reference

QEvent class and basic macros used by all QP components. More...

Go to the source code of this file.

Classes

struct  QEvent
 QEvent base class. More...

Defines

#define QP_VERSION   0x4300U
 The current QP version number.
#define Q_ROM
 Macro to specify compiler-specific directive for placing a constant object in ROM.
#define Q_ROM_VAR
 Macro to specify compiler-specific directive for accessing a constant object in ROM.
#define Q_ROM_BYTE(rom_var_)   (rom_var_)
 Macro to access a byte allocated in ROM.
#define Q_SIGNAL_SIZE   2
 The size (in bytes) of the signal of an event. Valid values: 1, 2, or 4; default 1.
#define Q_DIM(array_)   (sizeof(array_) / sizeof(array_[0]))

Typedefs

typedef uint16_t QSignal
 QSignal represents the signal of an event.

Detailed Description

QEvent class and basic macros used by all QP components.

This header file must be included, perhaps indirectly, in all modules (*.cpp files) that use any component of QP/C++ (such as QEP, QF, or QK).

Definition in file qevent.h.


Define Documentation

#define Q_DIM (   array_)    (sizeof(array_) / sizeof(array_[0]))

helper macro to calculate static dimension of a 1-dim array array_

Definition at line 152 of file qevent.h.

Referenced by QF::poolInit(), and QF::publish().

#define Q_ROM

Macro to specify compiler-specific directive for placing a constant object in ROM.

Many compilers for Harvard-architecture MCUs provide non-stanard extensions to support placement of objects in different memories. In order to conserve the precious RAM, QP uses the Q_ROM macro for all constant objects that can be allocated in ROM.

To override the following empty definition, you need to define the Q_ROM macro in the qep_port.h header file. Some examples of valid Q_ROM macro definitions are: __code (IAR 8051 compiler), code (Keil Cx51 compiler), PROGMEM (gcc for AVR), __flash (IAR for AVR).

Definition at line 63 of file qevent.h.

Referenced by QF::getPortVersion(), QS::getVersion(), and QF::getVersion().

#define Q_ROM_BYTE (   rom_var_)    (rom_var_)

Macro to access a byte allocated in ROM.

Some compilers for Harvard-architecture MCUs, such as gcc for AVR, do not generate correct code for accessing data allocated in the program space (ROM). The workaround for such compilers is to explictly add assembly code to access each data element allocated in the program space. The macro Q_ROM_BYTE() retrieves a byte from the given ROM address.

The Q_ROM_BYTE() macro should be defined for the compilers that cannot handle correctly data allocated in ROM (such as the gcc). If the macro is left undefined, the default definition simply returns the argument and lets the compiler generate the correct code.

Definition at line 95 of file qevent.h.

Referenced by QPSet8::findMax(), QPSet64::findMax(), QPSet8::hasElement(), QPSet64::hasElement(), QPSet8::insert(), QPSet64::insert(), QF::publish(), QPSet8::remove(), QPSet64::remove(), QS::str_ROM(), QS::str_ROM_(), QActive::subscribe(), QActive::unsubscribe(), and QActive::unsubscribeAll().

#define Q_ROM_VAR

Macro to specify compiler-specific directive for accessing a constant object in ROM.

Many compilers for MCUs provide different size pointers for accessing objects in various memories. Constant objects allocated in ROM (see Q_ROM macro) often mandate the use of specific-size pointers (e.g., far pointers) to get access to ROM objects. The macro Q_ROM_VAR specifies the kind of the pointer to be used to access the ROM objects.

To override the following empty definition, you need to define the Q_ROM_VAR macro in the qep_port.h header file. An example of valid Q_ROM_VAR macro definition is: __far (Freescale HC(S)08 compiler).

Definition at line 79 of file qevent.h.

Referenced by QS::getVersion(), and QF::getVersion().

#define Q_SIGNAL_SIZE   2

The size (in bytes) of the signal of an event. Valid values: 1, 2, or 4; default 1.

This macro can be defined in the QEP port file (qep_port.h) to configure the QSignal type. When the macro is not defined, the default of 1 byte is chosen.

Definition at line 105 of file qevent.h.

#define QP_VERSION   0x4300U

The current QP version number.

Returns:
version of the QP as a hex constant constant 0xXYZZ, where X is a 1-digit major version number, Y is a 1-digit minor version number, and ZZ is a 2-digit release number.

Definition at line 48 of file qevent.h.

Referenced by QEP::getVersion(), QS::getVersion(), QK::getVersion(), and QF::getVersion().


Typedef Documentation

typedef uint16_t QSignal

QSignal represents the signal of an event.

The relationship between an event and a signal is as follows. A signal in UML is the specification of an asynchronous stimulus that triggers reactions [UML document ptc/03-08-02], and as such is an essential part of an event. (The signal conveys the type of the occurrence-what happened?) However, an event can also contain additional quantitative information about the occurrence in form of event parameters. Please refer to the

Definition at line 119 of file qevent.h.