Buffer.cpp
Go to the documentation of this file.
1 
24 #include "Buffer.h"
25 
26 template <class T>
27 Buffer<T>::Buffer(uint32_t size)
28 {
29  _buf = new T [size];
30  _size = size;
31  clear();
32 
33  return;
34 }
35 
36 template <class T>
38 {
39  delete [] _buf;
40 
41  return;
42 }
43 
44 template <class T>
45 uint32_t Buffer<T>::getSize()
46 {
47  return this->_size;
48 }
49 
50 template <class T>
51 void Buffer<T>::clear(void)
52 {
53  _wloc = 0;
54  _rloc = 0;
55  memset(_buf, 0, _size);
56 
57  return;
58 }
59 
60 template <class T>
61 uint32_t Buffer<T>::peek(char c)
62 {
63  return 1;
64 }
65 
66 // make the linker aware of some possible types
67 template class Buffer<uint8_t>;
68 template class Buffer<int8_t>;
69 template class Buffer<uint16_t>;
70 template class Buffer<int16_t>;
71 template class Buffer<uint32_t>;
72 template class Buffer<int32_t>;
73 template class Buffer<uint64_t>;
74 template class Buffer<int64_t>;
75 template class Buffer<char>;
76 template class Buffer<wchar_t>;
Buffer(uint32_t size=0x100)
Definition: Buffer.cpp:27
uint32_t peek(char c)
Definition: Buffer.cpp:61
uint32_t getSize()
Definition: Buffer.cpp:45
Definition: Buffer.h:61
~Buffer()
Definition: Buffer.cpp:37
void clear(void)
Definition: Buffer.cpp:51
Software Buffer - Templated Ring Buffer for most data types.


rosserial_mbed
Author(s): Gary Servin
autogenerated on Mon Jun 10 2019 14:53:26