The MGC3130 is the world’s first electrical-field (E-field) based three-dimensional (3D) tracking and gesture controller
Dependents: NucleoMGC3130 i2c_master
GestILibrarMessage/BufferedArray.h
- Committer:
- yangcq88517
- Date:
- 2015-10-15
- Revision:
- 7:eacd776fce29
- Parent:
- 6:b511421e7dc8
File content as of revision 7:eacd776fce29:
#ifndef UK_AC_HERTS_SMARTLAB_BufferedArray #define UK_AC_HERTS_SMARTLAB_BufferedArray #include "mbed.h" /** * Represent a generic, dynamic-length raw binary data buffer. */ class BufferedArray { protected : /// initial size and automatically increase length. static const int EXPANDSIZE = 20; /// Raw data char * data; /// Current index of the data, could also used as data lendth. int index; /// Max data size that the raw data can hold. int max; void expandSpace(int length); public: BufferedArray(); BufferedArray(int size); BufferedArray(BufferedArray * bufferedArray); ~BufferedArray(); /** Get the raw data. * @returns char array. */ char * gets(); /** Get the raw data from a specific location. * * @param position where to retrieve * * @returns char array. */ char * gets(int position); /** Get 1 byte data from a specific location. * * @param position where to retrieve * * @returns char. */ char get(int position); /** Get the current index. * @returns char array. */ int getPosition(); /** Set the index within the max length of raw data. * @param position where to begin read and write */ void setPosition(int position); /** Reset the raw data. * @param length current max size for the raw data */ void allocate(int length); /** Reset the position and does not affect the content of the data. * @param length current max size for the raw data */ void rewind(); /** Write 8-bit data into current posiston and increase by 1. * @param value sigle byte */ void set(char value); /** Write array of data into current posiston, and increase by the lenght. * @param value array of byte * @param offset start point of the data * @param length length to write */ void sets(const char * value, int offset, int length); /** Write 8-bit data into specific posiston and deos not affect the current position. * @param position where to write * @param value sigle byte */ void set(int position, char value); /** Write array of data into specific posiston and deos not affect the current position. * @param position where to write * @param value array of byte * @param offset start point of the data * @param length length to write */ void sets(int position, const char * value, int offset, int length); }; #endif