|
| 1 | +/* |
| 2 | + Copyright (C) 2017 Statoil ASA, Norway. |
| 3 | +
|
| 4 | + The file 'config_settings.c' 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_CONFIG_SETTINGS_H |
| 20 | +#define ERT_CONFIG_SETTINGS_H |
| 21 | + |
| 22 | +#ifdef __cplusplus |
| 23 | +extern "C" { |
| 24 | +#endif |
| 25 | +#include <stdbool.h> |
| 26 | + |
| 27 | +#include <ert/util/stringlist.h> |
| 28 | + |
| 29 | +#include <ert/config/config_parser.h> |
| 30 | +#include <ert/config/config_content.h> |
| 31 | +#include <ert/config/config_schema_item.h> |
| 32 | + |
| 33 | +typedef struct config_settings_struct config_settings_type; |
| 34 | + |
| 35 | +config_settings_type * config_settings_alloc( const char * root_key ); |
| 36 | +void config_settings_free( config_settings_type * settings); |
| 37 | +bool config_settings_has_key( const config_settings_type * settings , const char * key); |
| 38 | +config_item_types config_settings_get_value_type( const config_settings_type * config_settings , const char * key); |
| 39 | +bool config_settings_set_value( const config_settings_type * config_settings , const char * key, const char * value); |
| 40 | +void config_settings_init_parser( const config_settings_type * config_settings, config_parser_type * config , bool required); |
| 41 | +void config_settings_init_parser__( const char * root_key , config_parser_type * config , bool required); |
| 42 | +void config_settings_apply(config_settings_type * config_settings , const config_content_type * config ); |
| 43 | +stringlist_type * config_settings_alloc_keys( const config_settings_type * config_settings ); |
| 44 | + |
| 45 | +bool config_settings_add_setting(config_settings_type * settings , const char* key, config_item_types value_type , const char* initial_value); |
| 46 | +void config_settings_add_int_setting(config_settings_type * settings , const char* key, int initial_value); |
| 47 | +void config_settings_add_double_setting(config_settings_type * settings , const char* key, double initial_value); |
| 48 | +void config_settings_add_string_setting(config_settings_type * settings , const char* key, const char * initial_value); |
| 49 | +void config_settings_add_bool_setting(config_settings_type * settings , const char* key, bool initial_value); |
| 50 | + |
| 51 | + |
| 52 | +const char * config_settings_get_value( const config_settings_type * config_settings , const char * key); |
| 53 | +const char * config_settings_get_string_value( const config_settings_type * config_settings , const char * key); |
| 54 | +int config_settings_get_int_value( const config_settings_type * config_settings , const char * key); |
| 55 | +bool config_settings_get_bool_value( const config_settings_type * config_settings , const char * key); |
| 56 | +double config_settings_get_double_value( const config_settings_type * config_settings , const char * key); |
| 57 | + |
| 58 | +bool config_settings_set_value( const config_settings_type * config_settings , const char * key, const char * value); |
| 59 | +bool config_settings_set_int_value( const config_settings_type * config_settings , const char * key, int value); |
| 60 | +bool config_settings_set_double_value( const config_settings_type * config_settings , const char * key, double value); |
| 61 | +bool config_settings_set_bool_value( const config_settings_type * config_settings , const char * key, bool value); |
| 62 | +bool config_settings_set_string_value( const config_settings_type * config_settings , const char * key, const char * value); |
| 63 | + |
| 64 | +#ifdef __cplusplus |
| 65 | +} |
| 66 | +#endif |
| 67 | +#endif |
0 commit comments