lib
inertial-sense-sdk
src
ISCommDataBuffer.h
Go to the documentation of this file.
1
#ifndef CCOMDATABUFFER_H
2
#define CCOMDATABUFFER_H
3
4
#include <vector>
5
#include <inttypes.h>
6
#include "
com_manager.h
"
7
#include "
ISUtilities.h
"
8
9
using namespace
std
;
10
11
class
cComDataBuffer
12
{
13
public
:
14
cComDataBuffer
();
15
virtual
~
cComDataBuffer
();
16
17
// add data to the data buffer for the pHandle using the data id in data, return 0 if success, otherwise error code
18
int
PushData(
int
pHandle,
const
p_data_t
*
data
);
19
20
// reads the entire data for a pHandle and data id into a vector of bytes - data will be cleared first, return 0 if success, otherwise error code
21
int
ReadData(
int
pHandle, uint32_t dataId, vector<uint8_t>& data);
22
23
// clear all data from memory and remove all temp files
24
void
Reset();
25
26
private
:
27
typedef
struct
28
{
29
FILE*
file
;
30
long
writeOffset
;
31
string
path
;
32
}
buffer_file_t
;
33
34
void
EnsureBuffers(
int
pHandle);
35
36
// for each pHandle, a vector for each data id containing a file of the raw data
37
vector<vector<buffer_file_t>>
m_buffers
;
38
39
// for each pHandle, a vector for each data id containing the a file with the timestamp for that data
40
vector<vector<buffer_file_t>>
m_timestamps
;
41
42
float
m_lastTimestamp
;
43
cMutex
m_mutex
;
44
string
basePath
;
45
46
};
47
48
extern
cComDataBuffer
g_comDataBuffer
;
49
50
#endif // CCOMDATABUFFER_H
cComDataBuffer
Definition:
ISCommDataBuffer.h:11
cComDataBuffer::m_lastTimestamp
float m_lastTimestamp
Definition:
ISCommDataBuffer.h:42
ISUtilities.h
cComDataBuffer::m_timestamps
vector< vector< buffer_file_t > > m_timestamps
Definition:
ISCommDataBuffer.h:40
std
g_comDataBuffer
cComDataBuffer g_comDataBuffer
Definition:
ISCommDataBuffer.cpp:10
cComDataBuffer::basePath
string basePath
Definition:
ISCommDataBuffer.h:44
cComDataBuffer::buffer_file_t
Definition:
ISCommDataBuffer.h:27
cComDataBuffer::m_buffers
vector< vector< buffer_file_t > > m_buffers
Definition:
ISCommDataBuffer.h:37
cComDataBuffer::buffer_file_t::path
string path
Definition:
ISCommDataBuffer.h:31
data
USBInterfaceDescriptor data
Definition:
CDCDSerialDriver.h:117
cComDataBuffer::buffer_file_t::writeOffset
long writeOffset
Definition:
ISCommDataBuffer.h:30
p_data_t
Definition:
ISComm.h:385
cComDataBuffer::buffer_file_t::file
FILE * file
Definition:
ISCommDataBuffer.h:29
cComDataBuffer::m_mutex
cMutex m_mutex
Definition:
ISCommDataBuffer.h:43
com_manager.h
inertial_sense_ros
Author(s):
autogenerated on Sat Sep 19 2020 03:19:04