Dining Philosophers Problem (DPP) example for the QP active object framework. Demonstrates: event-driven programming, hierarchical state machines in C++, modeling and graphical state machine design, code generation, preemptive multitasking, software tracing, power saving mode, direct event posting, publish-subscribe. More information available in the [[/users/QL/notebook|Quantum Leaps Notebook pages]]. See also [[http://www.state-machine.com|state-machine.com]].

Dependencies:   mbed qp

dpp.h

Committer:
QL
Date:
2012-09-05
Revision:
5:15aad9bccbbd
Parent:
4:6189d844a1a2

File content as of revision 5:15aad9bccbbd:

//////////////////////////////////////////////////////////////////////////////
// Model: dpp.qm
// File:  ././dpp.h
//
// This file has been generated automatically by QP Modeler (QM).
// DO NOT EDIT THIS FILE MANUALLY.
//
// Please visit www.state-machine.com/qm for more information.
//////////////////////////////////////////////////////////////////////////////
#ifndef dpp_h
#define dpp_h

namespace DPP {

enum DPPSignals {
    EAT_SIG = QP::Q_USER_SIG, // published by Table to let a philosopher eat
    DONE_SIG,                 // published by Philosopher when done eating
    PAUSE_SIG,                // published by BSP to pause the application
    TERMINATE_SIG,            // published by BSP to terminate the application
    MAX_PUB_SIG,              // the last published signal

    HUNGRY_SIG,               // posted direclty to Table from hungry Philo
    MAX_SIG                   // the last signal
};

// @(/1/0) ...................................................................
class TableEvt : public QP::QEvt {
public:
    uint8_t philoNum;
};

// number of philosophers
#define N_PHILO ((uint8_t)5)

extern QP::QActive * const AO_Philo[N_PHILO];
extern QP::QActive * const AO_Table;

}                             // namespace DPP

#endif                        // dpp_h