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.
linearArray.h@3:8e9f85814809, 2017-03-01 (annotated)
- Committer:
- UHSLMarcus
- Date:
- Wed Mar 01 10:35:15 2017 +0000
- Revision:
- 3:8e9f85814809
- Parent:
- 2:92576523c23e
- Child:
- 4:7743528fb9e5
changed method names to match queues
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| UHSLMarcus | 0:23c500341c13 | 1 | #ifndef LINEAR_ARRAY_H |
| UHSLMarcus | 0:23c500341c13 | 2 | #define LINEAR_ARRAY_H |
| UHSLMarcus | 0:23c500341c13 | 3 | |
| UHSLMarcus | 0:23c500341c13 | 4 | #include "mbed.h" |
| UHSLMarcus | 0:23c500341c13 | 5 | |
| UHSLMarcus | 0:23c500341c13 | 6 | template <class type> |
| UHSLMarcus | 0:23c500341c13 | 7 | class LinearArray { |
| UHSLMarcus | 0:23c500341c13 | 8 | public: |
| UHSLMarcus | 0:23c500341c13 | 9 | LinearArray(int size); |
| UHSLMarcus | 0:23c500341c13 | 10 | ~LinearArray(); |
| UHSLMarcus | 3:8e9f85814809 | 11 | int push(type item); |
| UHSLMarcus | 3:8e9f85814809 | 12 | type pop(int index = 0); |
| UHSLMarcus | 3:8e9f85814809 | 13 | type& peek(int index = 0); |
| UHSLMarcus | 0:23c500341c13 | 14 | int size(); |
| UHSLMarcus | 1:49758f1e1317 | 15 | int elements(); |
| UHSLMarcus | 0:23c500341c13 | 16 | bool hasSpace(); |
| UHSLMarcus | 3:8e9f85814809 | 17 | bool empty(); |
| UHSLMarcus | 0:23c500341c13 | 18 | private: |
| UHSLMarcus | 0:23c500341c13 | 19 | type* array; |
| UHSLMarcus | 0:23c500341c13 | 20 | int elem_count; |
| UHSLMarcus | 2:92576523c23e | 21 | int array_size; |
| UHSLMarcus | 3:8e9f85814809 | 22 | |
| UHSLMarcus | 3:8e9f85814809 | 23 | int elem_decrease(); |
| UHSLMarcus | 3:8e9f85814809 | 24 | int elem_increase(); |
| UHSLMarcus | 0:23c500341c13 | 25 | }; |
| UHSLMarcus | 0:23c500341c13 | 26 | |
| UHSLMarcus | 1:49758f1e1317 | 27 | #include "linearArray.hpp" |
| UHSLMarcus | 1:49758f1e1317 | 28 | |
| UHSLMarcus | 3:8e9f85814809 | 29 | #endif /* LINEAR_ARRAY_H */ |