USB Host Driver with Socket Modem support. Works with revision 323 of mbed-src but broken with any later version.
Dependencies: FATFileSystem
Fork of F401RE-USBHost by
USBHost/myvector.h@26:53970cabf56d, 2015-06-26 (annotated)
- Committer:
- fritz291
- Date:
- Fri Jun 26 19:30:55 2015 +0000
- Revision:
- 26:53970cabf56d
- Parent:
- 16:981c3104f6c0
Fixed small error in testAT function
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
va009039 | 10:40c7f6788902 | 1 | #pragma once |
va009039 | 10:40c7f6788902 | 2 | |
va009039 | 10:40c7f6788902 | 3 | template<class T> |
va009039 | 10:40c7f6788902 | 4 | class myvector { |
va009039 | 10:40c7f6788902 | 5 | public: |
va009039 | 10:40c7f6788902 | 6 | myvector() { |
va009039 | 10:40c7f6788902 | 7 | m_size = 0; |
va009039 | 10:40c7f6788902 | 8 | m_buf = NULL; |
va009039 | 10:40c7f6788902 | 9 | } |
va009039 |
16:981c3104f6c0 | 10 | ~myvector() { |
va009039 |
16:981c3104f6c0 | 11 | if (m_buf) { |
va009039 |
16:981c3104f6c0 | 12 | delete[] m_buf; |
va009039 |
16:981c3104f6c0 | 13 | } |
va009039 |
16:981c3104f6c0 | 14 | } |
va009039 | 10:40c7f6788902 | 15 | void push_back(T v) { |
va009039 | 10:40c7f6788902 | 16 | T* new_buf = new T[m_size+1]; |
va009039 | 10:40c7f6788902 | 17 | if (m_size > 0) { |
va009039 | 10:40c7f6788902 | 18 | for(int i = 0; i < m_size; i++) { |
va009039 | 10:40c7f6788902 | 19 | new_buf[i] = m_buf[i]; |
va009039 | 10:40c7f6788902 | 20 | } |
va009039 | 10:40c7f6788902 | 21 | delete[] m_buf; |
va009039 | 10:40c7f6788902 | 22 | } |
va009039 | 10:40c7f6788902 | 23 | m_buf = new_buf; |
va009039 | 10:40c7f6788902 | 24 | m_buf[m_size++] = v; |
va009039 | 10:40c7f6788902 | 25 | } |
va009039 | 10:40c7f6788902 | 26 | T& operator[](const int index) { |
va009039 | 10:40c7f6788902 | 27 | return m_buf[index]; |
va009039 | 10:40c7f6788902 | 28 | } |
va009039 | 10:40c7f6788902 | 29 | int size() { return m_size; } |
va009039 | 10:40c7f6788902 | 30 | |
va009039 | 10:40c7f6788902 | 31 | private: |
va009039 | 10:40c7f6788902 | 32 | int m_size; |
va009039 | 10:40c7f6788902 | 33 | T *m_buf; |
va009039 | 10:40c7f6788902 | 34 | }; |