diff options
Diffstat (limited to 'libsensors_iio/src/CircularBuffer.h')
-rw-r--r-- | libsensors_iio/src/CircularBuffer.h | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/libsensors_iio/src/CircularBuffer.h b/libsensors_iio/src/CircularBuffer.h deleted file mode 100644 index c07eb1f..0000000 --- a/libsensors_iio/src/CircularBuffer.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (C) 2013-2015 STMicroelectronics - * Author: Denis Ciocca - <denis.ciocca@st.com> - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ST_CIRCULAR_BUFFER_H -#define ST_CIRCULAR_BUFFER_H - -#include <sys/cdefs.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <time.h> -#include <pthread.h> -#include <errno.h> - -typedef struct SensorBaseData { - float raw[4]; - float offset[4]; - float processed[4]; - int64_t timestamp; -} SensorBaseData; - -/* - * class CircularBuffer - */ -class CircularBuffer { -private: - pthread_mutex_t data_mutex; - unsigned int lenght, elements_available; - - SensorBaseData *data_sensor; - SensorBaseData *first_available_element; - SensorBaseData *first_free_element; - -public: - CircularBuffer(unsigned int num_elements); - ~CircularBuffer(); - - void writeElement(SensorBaseData *data); - int readElement(SensorBaseData *data); -}; - -#endif /* ST_CIRCULAR_BUFFER_H */ |