Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: RequestQueue.h
- Revision:
- 2:2cc70773996b
- Parent:
- 1:4ec28912c9e7
- Child:
- 3:c3d716d6c6a7
--- a/RequestQueue.h Thu Mar 26 02:25:46 2015 +0000
+++ b/RequestQueue.h Thu Mar 26 06:10:56 2015 +0000
@@ -3,17 +3,31 @@
#ifndef REQUESTQUEUE_H
#define REQUESTQUEUE_H
-class LiftQueue {
+class RequestQueue {
-private :
-
- int floor;
+private :
+ int floorRequests[5];
+public :
+ RequestQueue() {
+ for(int i=0;i<5;i++)
+ floorRequests[i] = 0;
+ }
-public :
-
- void push (int);
-
- void pop ();
+ void add(int);
+ void remove(int);
+ int isRequested (int);
};
+void RequestQueue::add (int i){
+ floorRequests[i] = 1;
+}
+
+void RequestQueue::remove (int i){
+ floorRequests[i] = 0;
+}
+
+int RequestQueue::isRequested (int i){
+ return floorRequests[i];
+}
+
#endif
\ No newline at end of file