17 std::vector<char> _buffer;
19 void setType (
char type)
21 if(type ==
'c' || type ==
'd' || type ==
'f')
27 printf(
"Type unkown. Creating byte (char) buffer.\n");
45 void setup(
char type,
unsigned int size)
48 unsigned int bufferSize = (_type ==
'c' ? size : size *
sizeof(float));
49 _buffer.resize(bufferSize);
61 return _buffer.size() /
sizeof(int32_t);
63 else if (_type ==
'f')
65 return _buffer.size() /
sizeof(float);
69 return _buffer.size();
91 std::vector<char>*
getBuffer() {
return &_buffer; };
99 int32_t*
getAsInt() {
return (int32_t*) _buffer.data(); };
unsigned int getCapacity()
Definition: DataBuffer.h:83
unsigned int getNumElements()
Definition: DataBuffer.h:57
Definition: DataBuffer.h:11
unsigned int getNumBytes()
Definition: DataBuffer.h:77
int32_t * getAsInt()
Definition: DataBuffer.h:99
char getType()
Definition: DataBuffer.h:87
void setup(char type, unsigned int size)
Definition: DataBuffer.h:45
float * getAsFloat()
Definition: DataBuffer.h:103
char * getAsChar()
Definition: DataBuffer.h:95
std::vector< char > * getBuffer()
Definition: DataBuffer.h:91