nemea-common  1.6.3
counting_sort.h
Go to the documentation of this file.
1 
8 /*
9  * Copyright (C) 2018 CESNET
10  *
11  * LICENSE TERMS
12  *
13  * Redistribution and use in source and binary forms, with or without
14  * modification, are permitted provided that the following conditions
15  * are met:
16  * 1. Redistributions of source code must retain the above copyright
17  * notice, this list of conditions and the following disclaimer.
18  * 2. Redistributions in binary form must reproduce the above copyright
19  * notice, this list of conditions and the following disclaimer in
20  * the documentation and/or other materials provided with the
21  * distribution.
22  * 3. Neither the name of the Company nor the names of its contributors
23  * may be used to endorse or promote products derived from this
24  * software without specific prior written permission.
25  *
26  * ALTERNATIVELY, provided that this notice is retained in full, this
27  * product may be distributed under the terms of the GNU General Public
28  * License (GPL) version 2 or later, in which case the provisions
29  * of the GPL apply INSTEAD OF those given above.
30  *
31  * This software is provided ``as is'', and any express or implied
32  * warranties, including, but not limited to, the implied warranties of
33  * merchantability and fitness for a particular purpose are disclaimed.
34  * In no event shall the company or contributors be liable for any
35  * direct, indirect, incidental, special, exemplary, or consequential
36  * damages (including, but not limited to, procurement of substitute
37  * goods or services; loss of use, data, or profits; or business
38  * interruption) however caused and on any theory of liability, whether
39  * in contract, strict liability, or tort (including negligence or
40  * otherwise) arising in any way out of the use of this software, even
41  * if advised of the possibility of such damage.
42  *
43  */
44 
45 #ifndef _NEMEA_COMMON_COUNTING_SORT_
46 #define _NEMEA_COMMON_COUNTING_SORT_
47 
48 #include <stdint.h>
49 
53 typedef enum {
56 } cs_order;
57 
61 typedef enum {
62  CS_SUCCESS = 0,
66 } cs_ret_code;
67 
87 cs_ret_code counting_sort(const void *input, void *output, uint32_t count, uint32_t size, uint32_t key_min,
88  uint32_t key_max, cs_order order, uint32_t (*get_key) (const void *));
89 
90 #endif /* _NEMEA_COMMON_COUNTING_SORT_ */
cs_ret_code counting_sort(const void *input, void *output, uint32_t count, uint32_t size, uint32_t key_min, uint32_t key_max, cs_order order, uint32_t(*get_key)(const void *))
cs_order
Possible orders - ascending and descending.
Definition: counting_sort.h:53
cs_ret_code
Possible return codes of counting sort function.
Definition: counting_sort.h:61