peerstreamer-src / src / int_bucket.h @ 9eb656e7
History | View | Annotate | Download (1.49 KB)
1 | 9eb656e7 | Luca Baldesi | /*******************************************************************
|
---|---|---|---|
2 | * PeerStreamer-ng is a P2P video streaming application exposing a ReST
|
||
3 | * interface.
|
||
4 | * Copyright (C) 2015 Luca Baldesi <luca.baldesi@unitn.it>
|
||
5 | *
|
||
6 | * This program is free software: you can redistribute it and/or modify
|
||
7 | * it under the terms of the GNU Affero General Public License as published by
|
||
8 | * the Free Software Foundation, either version 3 of the License, or
|
||
9 | * (at your option) any later version.
|
||
10 | *
|
||
11 | * This program is distributed in the hope that it will be useful,
|
||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
14 | * GNU Affero General Public License for more details.
|
||
15 | *
|
||
16 | * You should have received a copy of the GNU Affero General Public License
|
||
17 | * along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
18 | *******************************************************************/
|
||
19 | |||
20 | #ifndef __INT_BUCKET_H__
|
||
21 | #define __INT_BUCKET_H__ 1 |
||
22 | |||
23 | #include <stdint.h> |
||
24 | |||
25 | #define INT_BUCKET_INC_SIZE 10 |
||
26 | |||
27 | struct int_bucket * int_bucket_new(const uint32_t size); |
||
28 | |||
29 | void int_bucket_destroy(struct int_bucket **ib); |
||
30 | |||
31 | int int_bucket_insert(struct int_bucket * ib,const uint32_t n,const uint32_t occurr); |
||
32 | |||
33 | void int_bucket_sum(struct int_bucket *dst, const struct int_bucket *op); |
||
34 | |||
35 | double int_bucket_occurr_norm(const struct int_bucket *dst); |
||
36 | |||
37 | uint32_t int_bucket_length(const struct int_bucket *ib); |
||
38 | |||
39 | const uint32_t * int_bucket_iter(const struct int_bucket *ib, const uint32_t * iter); |
||
40 | |||
41 | #endif |