Site Map | Contact Us
Quantum Leaps - innovating embedded systems Call us toll-free!
 

Products / Quantum Platform / QEP

Overview
Quantum Event Processor (QEP)
Quantum Framework (QF)
Quantum Kernel (QK)
Quantum Spy (QS)
products

  Related Links
   Quantum Platform (QP)
   Code/Manuals
   Application Notes
   Licensing
  
Features
High Portability
Explanation of Internals
Versions of QEP
Clean, Portable, Source Code
Performance
Small Footprint
Object-Orientation
Design by Contract™

QEP Brochure QEP Brochure (700KB)


Application
   Quantum Event Processor (QEP)   
Quantum Framework™ (QF) Quantum Spy™ (QS)
Quantum Kernel (QK) or other Kernel/RTOS
Target Hardware

Quantum Event Processor (QEP) is a generic, portable, and reusable state machine engine that processes events according to the general semantics of UML™ state machines. QEP provides facilities for executing Hierarchical State Machines (HSMs) as well as the simpler traditional Finite State Machines (FSMs). QEP is a passive component, which means that it needs to be externally called to handle events. The event processor is designed to operate with almost any event queuing and dispatching mechanisms, which are also necessary components of a hypothetical state machine [OMG 01]. For example, QEP can be used with virtually all existing event-driven environments, such as Quantum Framework™ (QF), GUI systems (e.g., Microsoft Windows™), Java™ event model, and many others. Currently QEP is available in C, C++, Java, C#, ActionScript, and other languages. QEP has been described in Part 1 of the book Practical Statecharts in C/C++.

Features

to topTop of page

High Portability

QEP is a passive component that does not make any operating system calls. Porting QEP is just a matter of recompilation.

to topTop of page

Explanation of Internals

The internals of QEP are described in Part 1 of the book: Practical Statecharts in C/C++, which is available worldwide from most technical bookstores and through online retailers, such as www.amazon.com. The quantum-leaps.com website provides ample coding "recipes", state design patterns, and application examples.

to topTop of page

Versions of QEP

Currently, versions of Quantum Event Processor are available in ANSI-C and Embedded C++. These are completely separate code sets, not merely a C++ interface to C.

to topTop of page

Clean, Portable, Source Code

All versions of QEP come with complete, very clean, portable, source code. The source code strictly complies with Quantum Leaps C/C++ Coding Standard, has been thoroughly "combed" with PC-Lint™, and is 99% compliant with the Motor Industry Software Reliability Association (MISRA) Guidelines For The Use of The C Language in Vehicle Based Software [MISRA 98]. All data types, constants, and functions in QEP start with the prefix 'Q' or 'QEP', which should make it easier to recognize that the services belong to the event processor and should minimize name compile-time and link-time conflicts with other software.

to topTop of page

Small Footprint

QEP is deployed as a very-fine granularity library for "self configuration", which is automatic elimination of unused features at link-time as opposed to hand-configuration at compile-time via preprocessor macros. Therefore QEP scales down automatically to include only code for features actually used.

QEP uses no standard C-runtime library (e.g., string manipulation, printf(), malloc(), etc.). Obviously, the event processor doesn't use any floating point operations, but even fixed-point division is carefully avoided (which might be important for ARM processors). This means that the standard C-runtime can be trimmed down drastically further reducing the code space requirements.

QEP does not use any RAM-intensive implementation techniques, such as state-tables. A state machine in QEP requires only a few bytes of RAM to store the current active state, but states are represented as pure code (ROM).

The event processor has been very carefully designed to conserve the stack space, which is particularly important in multitasking environments, where each task (active object) runs on it's own stack.

to topTop of page

Performance

QEC event dispatching is very fast and requires de-referencing only a single function pointer. However, for complicated transitions between arbitrarily nested states the event processor must find and execute correct chain of exit/entry actions and initial transitions, which can be somewhat expensive. To speed up frequently executed time-critical transitions, QEP offers an optional "static state transition" optimization. At the cost of several bytes in RAM, the transition chain can be evaluated only once and stored for quick "playback" on subsequent executions of the transition.

to topTop of page

Object Orientation

The basic architecture of QEP is fundamentally object-oriented, which means that QEP uses encapsulation (classes) and inheritance (deriving new classes from the existing ones).

Object-orientation of the C version of QEP might be perceived as an obstacle to some C programmers. However, the way encapsulation and inheritance are used in QEP/C should, in fact, come as very familiar to any C programmer. A Quantum Leaps coding recipe "Simple Encapsulation and Inheritance in C" describes how QF/C implements these object-oriented concepts. Earlier versions of QEP (v.2.x) used more advanced OOP techniques in C, called "C+". Starting from version 3.0 QEP/C does not use "C+", although it is fully compatible with "C+".

to topTop of page

Design by Contract™

An important aspect of QEP that you, as the event processor user, need to understand is the way it uses assertions. In this respect, the QEP applies elements of the Design by Contract™ (DBC) methodology pioneered by Bertrand Meyer [Meyer 97]. (See also C/C++ Users Journal Article "An Exception or a Bug".)

DBC is a different, much more modern philosophy compared to traditional technique of returning error status from API calls. You'll see no error returns from QEP. Instead, QEP uses assertions internally to help you detect errors, not so much inside the event processor, but in the state machines implemented with it. The assertion facilities used inside QEP are simple, but highly customizable to the domain of RTE systems.

to topTop of page


Version: April 20, 2006