Simple USBHost MSD(USB flash drive) for EA LPC4088 QSB test program

Dependencies:   LPC4088-USBHost mbed

EA LPC4088をUSBホストにしてUSBフラッシュメモリ(USB flash drive)を読み書きするテストプログラムです。
/media/uploads/va009039/lpc4088-msd-1.jpg
/media/uploads/va009039/lpc4088-msd-2.png

https://bitbucket.org/va009039/lpc4088_usbhost

LPC4088-USBHost/USBHost/myvector.h

Committer:
va009039
Date:
2014-04-22
Revision:
0:11152e69fc05

File content as of revision 0:11152e69fc05:

#pragma once

template<class T>
class myvector {
public:
    myvector() {
        m_size = 0;
        m_buf = NULL;
    }
    ~myvector() {
        if (m_buf) {
            delete[] m_buf;
        }
    }
    void push_back(T v) {
        T* new_buf = new T[m_size+1];
        if (m_size > 0) {
            for(int i = 0; i < m_size; i++) {
                new_buf[i] = m_buf[i];
            }
            delete[] m_buf;
        }
        m_buf = new_buf;
        m_buf[m_size++] = v;
    }
    T& operator[](const int index) {
        return m_buf[index];
    }
    int size() { return m_size; }

private:
    int m_size;
    T *m_buf;
};