Buffer for general purpose use. Templated for most datatypes
Dependents: BufferedSoftSerial 09_PT1000 10_PT1000 11_PT1000 ... more
Example
#include "mbed.h" #include "Buffer.h" Buffer <char> buf; int main() { buf = 'a'; buf.put('b'); char *head = buf.head(); puts(head); char whats_in_there[2] = {0}; int pos = 0; while(buf.available()) { whats_in_there[pos++] = buf; } printf("%c %c\n", whats_in_there[0], whats_in_there[1]); buf.clear(); error("done\n\n\n"); }
Diff: Buffer.cpp
- Revision:
- 5:7b754354b99c
- Parent:
- 4:cd0a1f4c623f
--- a/Buffer.cpp Wed Jun 26 15:24:27 2013 +0000 +++ b/Buffer.cpp Wed Jan 07 18:34:56 2015 +0000 @@ -42,6 +42,12 @@ } template <class T> +uint32_t Buffer<T>::getSize() +{ + return this->_size; +} + +template <class T> void Buffer<T>::clear(void) { _wloc = 0; @@ -68,4 +74,3 @@ template class Buffer<int64_t>; template class Buffer<char>; template class Buffer<wchar_t>; -