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.
RequestQueue.h@2:2cc70773996b, 2015-03-26 (annotated)
- Committer:
- avinashr
- Date:
- Thu Mar 26 06:10:56 2015 +0000
- Revision:
- 2:2cc70773996b
- Parent:
- 1:4ec28912c9e7
- Child:
- 3:c3d716d6c6a7
Basic algorithm in place;
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| avinashr | 1:4ec28912c9e7 | 1 | #include "mbed.h" |
| avinashr | 1:4ec28912c9e7 | 2 | |
| avinashr | 1:4ec28912c9e7 | 3 | #ifndef REQUESTQUEUE_H |
| avinashr | 1:4ec28912c9e7 | 4 | #define REQUESTQUEUE_H |
| avinashr | 1:4ec28912c9e7 | 5 | |
| avinashr | 2:2cc70773996b | 6 | class RequestQueue { |
| avinashr | 1:4ec28912c9e7 | 7 | |
| avinashr | 2:2cc70773996b | 8 | private : |
| avinashr | 2:2cc70773996b | 9 | int floorRequests[5]; |
| avinashr | 2:2cc70773996b | 10 | public : |
| avinashr | 2:2cc70773996b | 11 | RequestQueue() { |
| avinashr | 2:2cc70773996b | 12 | for(int i=0;i<5;i++) |
| avinashr | 2:2cc70773996b | 13 | floorRequests[i] = 0; |
| avinashr | 2:2cc70773996b | 14 | } |
| avinashr | 1:4ec28912c9e7 | 15 | |
| avinashr | 2:2cc70773996b | 16 | void add(int); |
| avinashr | 2:2cc70773996b | 17 | void remove(int); |
| avinashr | 2:2cc70773996b | 18 | int isRequested (int); |
| avinashr | 1:4ec28912c9e7 | 19 | }; |
| avinashr | 1:4ec28912c9e7 | 20 | |
| avinashr | 2:2cc70773996b | 21 | void RequestQueue::add (int i){ |
| avinashr | 2:2cc70773996b | 22 | floorRequests[i] = 1; |
| avinashr | 2:2cc70773996b | 23 | } |
| avinashr | 2:2cc70773996b | 24 | |
| avinashr | 2:2cc70773996b | 25 | void RequestQueue::remove (int i){ |
| avinashr | 2:2cc70773996b | 26 | floorRequests[i] = 0; |
| avinashr | 2:2cc70773996b | 27 | } |
| avinashr | 2:2cc70773996b | 28 | |
| avinashr | 2:2cc70773996b | 29 | int RequestQueue::isRequested (int i){ |
| avinashr | 2:2cc70773996b | 30 | return floorRequests[i]; |
| avinashr | 2:2cc70773996b | 31 | } |
| avinashr | 2:2cc70773996b | 32 | |
| avinashr | 1:4ec28912c9e7 | 33 | #endif |