ROHC compression/decompression library
rohc_stats.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2013 Didier Barvaux
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Lesser General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2.1 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Lesser General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Lesser General Public
00015  * License along with this library; if not, write to the Free Software
00016  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00017  */
00018 
00019 /**
00020  * @file   rohc_stats.h
00021  * @brief  Handle a rolling window of values for statistics
00022  * @author Didier Barvaux <didier@barvaux.org>
00023  */
00024 
00025 #ifndef ROHC_STATS_H
00026 #define ROHC_STATS_H
00027 
00028 #if !defined(ROHC_ENABLE_DEPRECATED_API) || ROHC_ENABLE_DEPRECATED_API == 1
00029 
00030 #include <stdint.h>
00031 #include <stdlib.h>
00032 
00033 #include "dllexport.h"
00034 
00035 
00036 /**
00037  * Record ROHC statistics with a rolling window
00038  */
00039 struct rohc_stats
00040 {
00041         uint32_t values[16];  /**< The window of statistics value */
00042         size_t oldest;        /**< The index of the oldest value */
00043         size_t next;          /**< The index of the next value */
00044         size_t count;         /**< The number of values */
00045 };
00046 
00047 
00048 void ROHC_EXPORT rohc_stats_add(struct rohc_stats *const stats,
00049                                 const uint32_t value)
00050         __attribute__((nonnull(1)));
00051 
00052 uint32_t ROHC_EXPORT rohc_stats_sum(const struct rohc_stats *const stats)
00053         __attribute__((nonnull(1), pure));
00054 
00055 uint32_t ROHC_EXPORT rohc_stats_mean(const struct rohc_stats *const stats)
00056         __attribute__((nonnull(1), pure));
00057 
00058 #endif /* ROHC_ENABLE_DEPRECATED_API */
00059 
00060 #endif
00061