QP/C++
qevent.h
Go to the documentation of this file.
00001 
00002 // Product: QEP/C++ platform-independent public interface
00003 // Last Updated for Version: 4.3.00
00004 // Date of the Last Update:  Nov 01, 2011
00005 //
00006 //                    Q u a n t u m     L e a P s
00007 //                    ---------------------------
00008 //                    innovating embedded systems
00009 //
00010 // Copyright (C) 2002-2011 Quantum Leaps, LLC. All rights reserved.
00011 //
00012 // This software may be distributed and modified under the terms of the GNU
00013 // General Public License version 2 (GPL) as published by the Free Software
00014 // Foundation and appearing in the file GPL.TXT included in the packaging of
00015 // this file. Please note that GPL Section 2[b] requires that all works based
00016 // on this software must also be made publicly available under the terms of
00017 // the GPL ("Copyleft").
00018 //
00019 // Alternatively, this software may be distributed and modified under the
00020 // terms of Quantum Leaps commercial licenses, which expressly supersede
00021 // the GPL and are specifically designed for licensees interested in
00022 // retaining the proprietary status of their code.
00023 //
00024 // Contact information:
00025 // Quantum Leaps Web site:  http://www.quantum-leaps.com
00026 // e-mail:                  info@quantum-leaps.com
00028 #ifndef qevent_h
00029 #define qevent_h
00030 
00037 
00038 #ifdef Q_USE_NAMESPACE
00039 namespace QP {
00040 #endif
00041 
00048 #define QP_VERSION      0x4300U
00049 
00050 #ifndef Q_ROM
00051 
00052 
00053 
00054 
00055 
00056 
00057 
00058 
00059 
00060 
00061 
00062 
00063     #define Q_ROM
00064 #endif
00065 #ifndef Q_ROM_VAR            // if NOT defined, provide the default definition
00066 
00067 
00068 
00069 
00070 
00071 
00072 
00073 
00074 
00075 
00076 
00077 
00078 
00079     #define Q_ROM_VAR
00080 #endif
00081 #ifndef Q_ROM_BYTE
00082 
00083 
00084 
00085 
00086 
00087 
00088 
00089 
00090 
00091 
00092 
00093 
00094 
00095     #define Q_ROM_BYTE(rom_var_)   (rom_var_)
00096 #endif
00097 
00098 #ifndef Q_SIGNAL_SIZE
00099 
00100 
00101 
00102 
00103 
00104 
00105     #define Q_SIGNAL_SIZE 2
00106 #endif
00107 #if (Q_SIGNAL_SIZE == 1)
00108     typedef uint8_t QSignal;
00109 #elif (Q_SIGNAL_SIZE == 2)
00110 
00111 
00112 
00113 
00114 
00115 
00116 
00117 
00118 
00119     typedef uint16_t QSignal;
00120 #elif (Q_SIGNAL_SIZE == 4)
00121     typedef uint32_t QSignal;
00122 #else
00123     #error "Q_SIGNAL_SIZE defined incorrectly, expected 1, 2, or 4"
00124 #endif
00125 
00139 struct QEvent {
00140     QSignal sig;                             
00141     uint8_t poolId_;                         
00142     uint8_t refCtr_;                                    
00143 
00144 #ifdef Q_EVT_CTOR
00145     QEvent(QSignal s) : sig(s) {}
00146     virtual ~QEvent() {}                                 // virtual destructor
00147 #endif
00148 };
00149 
00152 #define Q_DIM(array_) (sizeof(array_) / sizeof(array_[0]))
00153 
00154 #ifdef Q_USE_NAMESPACE
00155 }                                                              // namespace QP
00156 #endif
00157 
00158 #endif                                                             // qevent_h