2 * collectd - src/sn_network.h
3 * Copyright (C) 2008-2010 Florian octo Forster
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; only version 2 of the License is applicable.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 * Florian octo Forster <ff at octo.it>
23 #define SN_NETWORK_H 1
27 #include "sn_comparator.h"
36 typedef struct sn_network_s sn_network_t;
38 #define SN_NETWORK_STAGE_NUM(n) (n)->stages_num
39 #define SN_NETWORK_STAGE_GET(n,i) ((n)->stages[i])
40 #define SN_NETWORK_INPUT_NUM(n) (n)->inputs_num
42 sn_network_t *sn_network_create (int inputs_num);
43 sn_network_t *sn_network_clone (const sn_network_t *n);
44 void sn_network_destroy (sn_network_t *n);
46 sn_network_t *sn_network_create_odd_even_mergesort (int inputs_num);
48 int sn_network_stage_add (sn_network_t *n, sn_stage_t *s);
49 int sn_network_stage_remove (sn_network_t *n, int s_num);
51 int sn_network_comparator_add (sn_network_t *n, const sn_comparator_t *c);
53 int sn_network_get_comparator_num (const sn_network_t *n);
55 int sn_network_sort (sn_network_t *n, int *values);
56 int sn_network_brute_force_check (sn_network_t *n);
58 int sn_network_show (sn_network_t *n);
59 int sn_network_invert (sn_network_t *n);
60 int sn_network_shift (sn_network_t *n, int s);
61 int sn_network_compress (sn_network_t *n);
62 int sn_network_normalize (sn_network_t *n);
64 int sn_network_cut_at (sn_network_t *n, int input, enum sn_network_cut_dir_e dir);
65 sn_network_t *sn_network_combine (sn_network_t *n0, sn_network_t *n1,
67 sn_network_t *sn_network_combine_bitonic (sn_network_t *n0, sn_network_t *n1);
68 sn_network_t *sn_network_combine_odd_even_merge (sn_network_t *n0, sn_network_t *n1);
70 sn_network_t *sn_network_read (FILE *fh);
71 sn_network_t *sn_network_read_file (const char *file);
72 int sn_network_write (sn_network_t *n, FILE *fh);
73 int sn_network_write_file (sn_network_t *n, const char *file);
75 int sn_network_serialize (sn_network_t *n, char **ret_buffer,
76 size_t *ret_buffer_size);
77 sn_network_t *sn_network_unserialize (char *buffer, size_t buffer_size);
78 #endif /* SN_NETWORK_H */
80 /* vim: set shiftwidth=2 softtabstop=2 : */