Fork of Sam Grove's Linked list library OS6 compliant.
LinkedList2.h@0:27649dfdde4c, 2020-12-29 (annotated)
- Committer:
- star297
- Date:
- Tue Dec 29 13:07:51 2020 +0000
- Revision:
- 0:27649dfdde4c
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
star297 | 0:27649dfdde4c | 1 | |
star297 | 0:27649dfdde4c | 2 | #ifndef LINKEDLIST_H_ |
star297 | 0:27649dfdde4c | 3 | #define LINKEDLIST_H_ |
star297 | 0:27649dfdde4c | 4 | |
star297 | 0:27649dfdde4c | 5 | #include <stdint.h> |
star297 | 0:27649dfdde4c | 6 | #include "mbed.h" |
star297 | 0:27649dfdde4c | 7 | |
star297 | 0:27649dfdde4c | 8 | struct node |
star297 | 0:27649dfdde4c | 9 | { |
star297 | 0:27649dfdde4c | 10 | void *data; |
star297 | 0:27649dfdde4c | 11 | struct node *next; |
star297 | 0:27649dfdde4c | 12 | }; |
star297 | 0:27649dfdde4c | 13 | |
star297 | 0:27649dfdde4c | 14 | template<class retT> |
star297 | 0:27649dfdde4c | 15 | class LinkedList2 |
star297 | 0:27649dfdde4c | 16 | { |
star297 | 0:27649dfdde4c | 17 | protected: |
star297 | 0:27649dfdde4c | 18 | retT *_head; |
star297 | 0:27649dfdde4c | 19 | public: |
star297 | 0:27649dfdde4c | 20 | LinkedList2(); |
star297 | 0:27649dfdde4c | 21 | ~LinkedList2(); |
star297 | 0:27649dfdde4c | 22 | retT *push(void *data); |
star297 | 0:27649dfdde4c | 23 | retT *append(void *data); |
star297 | 0:27649dfdde4c | 24 | retT *remove(uint32_t loc); |
star297 | 0:27649dfdde4c | 25 | retT *pop(uint32_t loc); |
star297 | 0:27649dfdde4c | 26 | uint32_t length(void); |
star297 | 0:27649dfdde4c | 27 | }; |
star297 | 0:27649dfdde4c | 28 | |
star297 | 0:27649dfdde4c | 29 | #endif |