Files
cppcourse/397/Ex11bug/Pelican.h
T
2026-10-05 11:27:21 +02:00

54 lines
1.3 KiB
C++

// ======================================================
//
// Represents a Pelican crossing
//
// ======================================================
#ifndef PELICAN_H
#define PELICAN_H
class PelicanTimer;
class Pole;
class Pelican {
public:
Pelican(int x, int y);
~Pelican();
// call when the WAIT button has been pressed
void press(void);
// states that a Pelican can be in
enum PelicanState { RED_STATE, YELLOW_FLASHING, GREEN_TIMING, GREEN_IDLE, YELLOW_STATE };
bool isPressed() const { return pressed; }
PelicanState getState() const { return state; }
private:
// state that this Pelican is in
PelicanState state;
// called by PeleicanTimer when the lights need to change
void timerExpired(void);
const unsigned int RED_TIME;
const unsigned int YELLOW_TIME;
const unsigned int GREEN_TIME;
const unsigned int FLASH_TIME;
// indicates whether the WAIT light should be on
bool pressed;
Pole *myPole;
// Timer that indicates when the lights should change
PelicanTimer *myTimer;
private:
// prevent general use of copy ctor and operator=
Pelican(const Pelican &);
Pelican &operator=(const Pelican &);
};
#endif