#ifndef _PDR_BUFFER_H_ #define _PDR_BUFFER_H_ #ifdef __cplusplus extern "C" { #endif /* Header File Including ------------------------------------------------------------------------ */ /* Macro Declaration ---------------------------------------------------------------------------- */ #define BUFFER_LONG_LENGTH 256 #define BUFFER_SHORT_LENGTH 10 #define BUFFER_TYPE_STACK 0 #define BUFFER_TYPE_QUEUE 1 #define BUFFER_NO_ERROR 0 #define BUFFER_WRONG_PARAMETER 1 #define BUFFER_OUT_OF_MEMORY 2 /* Structure Declaration ------------------------------------------------------------------------ */ #pragma pack (4) typedef struct BUFFER { char name[20]; int type; int length; int _bottom; int _top; int reserved; double sum; double mean; float data[BUFFER_LONG_LENGTH + 1]; }Buffer_t; typedef struct BUFFER_LONG { char name[20]; int type; int length; int _bottom; int _top; int reserved; double sum; double mean; float data[BUFFER_LONG_LENGTH + 1]; } BUFFER_LONG; typedef struct BUFFER_SHORT { char name[20]; int type; int length; int _bottom; int _top; int reserved; double sum; double mean; float data[BUFFER_SHORT_LENGTH + 1]; } BUFFER_SHORT; #pragma pack () /* Global Variable Declaration ------------------------------------------------------------------ */ /* Function Declaration ------------------------------------------------------------------------- */ int BufferInit(Buffer_t *buffer, const char *name, int type, int length); int BufferClear(Buffer_t *buffer); int BufferCount(Buffer_t *buffer, int *count); int BufferGetTop(Buffer_t *buffer, float *value); int BufferGetBottom(Buffer_t *buffer, float *value); int BufferPop(Buffer_t *buffer, float *value); int BufferPush(Buffer_t *buffer, float value); int BufferGet(Buffer_t *buffer, float *value, int index); int BufferMean(Buffer_t *buffer, float *mean); int BufferVar(Buffer_t *buffer, float *var); int BufferStd(Buffer_t *buffer, float *std); #ifdef __cplusplus } #endif #endif