Fledge
An open source edge computing platform for industrial users
databuffer.h
1 #ifndef _DATABUFFER_H
2 #define _DATABUFFER_H
3 /*
4  * Fledge Databuffer type for datapoints
5  *
6  * Copyright (c) 2021 Dianomic Systems
7  *
8  * Released under the Apache 2.0 Licence
9  *
10  * Author: Mark Riddoch
11  */
12 #include <unistd.h>
13 
19 class DataBuffer {
20  public:
21  DataBuffer(size_t itemSize, size_t len);
22  DataBuffer(const DataBuffer& rhs);
23  DataBuffer& operator=(const DataBuffer& rhs);
24  ~DataBuffer();
25  void populate(void *src, int len);
29  size_t getItemSize() { return m_itemSize; };
33  size_t getItemCount() { return m_len; };
37  void *getData() { return m_data; };
38  protected:
39  DataBuffer() {};
40  size_t m_itemSize;
41  size_t m_len;
42  void *m_data;
43 };
44 
45 #endif
void * getData()
Return a pointer to the raw data in the data buffer.
Definition: databuffer.h:37
size_t getItemSize()
Return the size of each item in the buffer.
Definition: databuffer.h:29
void populate(void *src, int len)
Populate the contents of a DataBuffer.
Definition: databuffer.cpp:63
~DataBuffer()
DataBuffer destructor.
Definition: databuffer.cpp:34
Buffer type for storage of arbitrary buffers of data within a datapoint.
Definition: databuffer.h:19
size_t getItemCount()
Return the number of items in the buffer.
Definition: databuffer.h:33