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@10:864b79e79ca8, 2017-03-14 (annotated)
- Committer:
- UHSLMarcus
- Date:
- Tue Mar 14 12:12:53 2017 +0000
- Revision:
- 10:864b79e79ca8
- Parent:
- 9:68d882e457c5
- Child:
- 11:1e27a6f0b0cf
- Child:
- 12:e4f557b33732
added debug lines
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 | 10:864b79e79ca8 | 5 | #include "temp_const.h" | 
| UHSLMarcus | 10:864b79e79ca8 | 6 | |
| UHSLMarcus | 0:23c500341c13 | 7 | |
| UHSLMarcus | 9:68d882e457c5 | 8 | template<class type> | 
| UHSLMarcus | 0:23c500341c13 | 9 | class LinearArray { | 
| UHSLMarcus | 9:68d882e457c5 | 10 | public: | 
| UHSLMarcus | 9:68d882e457c5 | 11 | LinearArray(int size, bool forced = false); | 
| UHSLMarcus | 9:68d882e457c5 | 12 | ~LinearArray(); | 
| UHSLMarcus | 9:68d882e457c5 | 13 | int push(type item); | 
| UHSLMarcus | 9:68d882e457c5 | 14 | type& pop(); | 
| UHSLMarcus | 9:68d882e457c5 | 15 | bool try_pop(type& item); | 
| UHSLMarcus | 9:68d882e457c5 | 16 | type& peek(); | 
| UHSLMarcus | 9:68d882e457c5 | 17 | type& peek(int idx); | 
| UHSLMarcus | 9:68d882e457c5 | 18 | int size(); | 
| UHSLMarcus | 9:68d882e457c5 | 19 | bool empty(); | 
| UHSLMarcus | 9:68d882e457c5 | 20 | bool full(); | 
| UHSLMarcus | 9:68d882e457c5 | 21 | int count(); | 
| UHSLMarcus | 9:68d882e457c5 | 22 | private: | 
| UHSLMarcus | 9:68d882e457c5 | 23 | type* _array; | 
| UHSLMarcus | 9:68d882e457c5 | 24 | int _elem_count; | 
| UHSLMarcus | 9:68d882e457c5 | 25 | int _array_size; | 
| UHSLMarcus | 9:68d882e457c5 | 26 | int _front; | 
| UHSLMarcus | 9:68d882e457c5 | 27 | int _rear; | 
| UHSLMarcus | 9:68d882e457c5 | 28 | bool _forced; | 
| UHSLMarcus | 0:23c500341c13 | 29 | |
| UHSLMarcus | 9:68d882e457c5 | 30 | }; | 
| UHSLMarcus | 1:49758f1e1317 | 31 | |
| UHSLMarcus | 10:864b79e79ca8 | 32 | |
| UHSLMarcus | 9:68d882e457c5 | 33 | #include "LinearArray.hpp" | 
| UHSLMarcus | 9:68d882e457c5 | 34 | |
| UHSLMarcus | 9:68d882e457c5 | 35 | #endif /* LINEAR_ARRAY_H */ |