hash.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2011 Equinor ASA, Norway.
3
4 The file 'hash.h' is part of ERT - Ensemble based Reservoir Tool.
5
6 ERT is free software: you can redistribute it and/or modify
7 it under the terms of the GNU 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 ERT is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE.
14
15 See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
16 for more details.
17*/
18
19#ifndef ERT_HASH_H
20#define ERT_HASH_H
21#ifdef __cplusplus
22extern"C" {
23#endif
24
25#include <stdlib.h>
26
30
31typedef struct hash_struct hash_type;
32typedef struct hash_iter_struct hash_iter_type;
33typedef void (hash_apply_ftype) (void * );
34
37
41void hash_free__(void *);
42void hash_insert_ref(hash_type * , const char * , const void *);
43void hash_insert_copy(hash_type *, const char * , const void *, copyc_ftype *, free_ftype *);
44void hash_insert_string(hash_type *, const char *, const char *);
45bool hash_has_key(const hash_type *, const char *);
46void * hash_pop( hash_type * hash , const char * key);
47void * hash_safe_get( const hash_type * hash , const char * key );
48void * hash_get(const hash_type *, const char *);
49char * hash_get_string(const hash_type * , const char *);
50void hash_del(hash_type *, const char *);
51void hash_safe_del(hash_type * , const char * );
54void hash_set_keylist(const hash_type * , char **);
57
58char ** hash_alloc_sorted_keylist (const hash_type *hash , int ( hash_get_cmp_value ) (const void *));
59char ** hash_alloc_key_sorted_list(const hash_type *hash, int (*cmp)(const void *, const void *));
60bool hash_key_list_compare(const hash_type * hash1, const hash_type * hash2);
61void hash_insert_hash_owned_ref(hash_type *, const char * , const void *, free_ftype *);
62void hash_resize(hash_type *hash, int new_size);
63
70
72bool hash_add_option( hash_type * hash, const char * key_value);
73
74int hash_inc_counter(hash_type * hash , const char * counter_key);
75int hash_get_counter(const hash_type * hash , const char * key);
76void hash_insert_int(hash_type * , const char * , int);
77int hash_get_int(const hash_type * , const char *);
78void hash_insert_double(hash_type * , const char * , double);
79double hash_get_double(const hash_type * , const char *);
80void hash_apply( hash_type * hash , hash_apply_ftype * func);
81
83
84#ifdef __cplusplus
85}
86#endif
87#endif
void hash_insert_int(hash_type *, const char *, int)
UTIL_SAFE_CAST_HEADER_CONST(hash)
void hash_apply(hash_type *hash, hash_apply_ftype *func)
char ** hash_alloc_key_sorted_list(const hash_type *hash, int(*cmp)(const void *, const void *))
void hash_insert_string(hash_type *, const char *, const char *)
void hash_del(hash_type *, const char *)
void hash_insert_ref(hash_type *, const char *, const void *)
void hash_iter_restart(hash_iter_type *iter)
int hash_inc_counter(hash_type *hash, const char *counter_key)
struct hash_iter_struct hash_iter_type
Definition: hash.hpp:32
int hash_get_size(const hash_type *)
bool hash_iter_is_complete(const hash_iter_type *)
void hash_resize(hash_type *hash, int new_size)
void * hash_get(const hash_type *, const char *)
bool hash_has_key(const hash_type *, const char *)
void hash_safe_del(hash_type *, const char *)
void() hash_apply_ftype(void *)
Definition: hash.hpp:33
hash_type * hash_alloc_from_options(const stringlist_type *)
void hash_iter_free(hash_iter_type *)
UTIL_SAFE_CAST_HEADER(hash)
void hash_free__(void *)
void hash_insert_hash_owned_ref(hash_type *, const char *, const void *, free_ftype *)
void hash_insert_double(hash_type *, const char *, double)
bool hash_add_option(hash_type *hash, const char *key_value)
void hash_insert_copy(hash_type *, const char *, const void *, copyc_ftype *, free_ftype *)
hash_type * hash_alloc(void)
void * hash_safe_get(const hash_type *hash, const char *key)
void hash_clear(hash_type *)
char * hash_get_string(const hash_type *, const char *)
void hash_iter_complete(hash_type *)
hash_iter_type * hash_iter_alloc(const hash_type *)
double hash_get_double(const hash_type *, const char *)
void hash_set_keylist(const hash_type *, char **)
void * hash_iter_get_next_value(hash_iter_type *)
bool hash_key_list_compare(const hash_type *hash1, const hash_type *hash2)
struct hash_struct hash_type
Definition: hash.hpp:31
void hash_free(hash_type *)
const char * hash_iter_get_next_key(hash_iter_type *)
int hash_get_counter(const hash_type *hash, const char *key)
void * hash_pop(hash_type *hash, const char *key)
stringlist_type * hash_alloc_stringlist(const hash_type *)
int hash_get_int(const hash_type *, const char *)
UTIL_IS_INSTANCE_HEADER(hash)
char ** hash_alloc_sorted_keylist(const hash_type *hash, int(hash_get_cmp_value)(const void *))
char ** hash_alloc_keylist(const hash_type *)
bool cmp(const ESmry &esmr, const ERsm &ersm)
void() free_ftype(void *)
Definition: node_data.hpp:29
void *() copyc_ftype(const void *)
Definition: node_data.hpp:28
struct stringlist_struct stringlist_type
Definition: stringlist.hpp:34