source: trunk/drmaa_utils/drmaa_utils/conf.h @ 1

Revision 1, 2.4 KB checked in by mmamonski, 13 years ago (diff)

Torque/PBS DRMAA initial commit

Line 
1/* $Id: conf.h 2 2009-10-12 09:51:22Z mamonski $ */
2/*
3 *  FedStage DRMAA utilities library
4 *  Copyright (C) 2006-2008  FedStage Systems
5 *
6 *  This program 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 *  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 General Public License for more details.
15 *
16 *  You should have received a copy of the GNU General Public License
17 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef __DRMAA_UTILS__CONF_H
21#define __DRMAA_UTILS__CONF_H
22
23#ifdef HAVE_CONFIG_H
24#       include <config.h>
25#endif
26
27#include <drmaa_utils/common.h>
28
29typedef enum {
30        FSD_CONF_INTEGER,
31        FSD_CONF_STRING,
32        FSD_CONF_DICT
33} fsd_conf_type_t;
34
35struct fsd_conf_option_s {
36        fsd_conf_type_t type;
37        union {
38                int integer;
39                char *string;
40                fsd_conf_dict_t *dict;
41        } val;
42};
43
44
45/**
46 * Read configuration.
47 */
48fsd_conf_dict_t *
49fsd_conf_read(
50                fsd_conf_dict_t *configuration,
51                const char *filename, bool must_exist,
52                const char *content, size_t content_len
53                );
54
55
56fsd_conf_dict_t *
57fsd_conf_load( const char *filename );
58
59fsd_conf_option_t *
60fsd_conf_option_create( fsd_conf_type_t type, void *value );
61
62void
63fsd_conf_option_destroy( fsd_conf_option_t *option );
64
65fsd_conf_option_t *
66fsd_conf_option_merge( fsd_conf_option_t *lhs, fsd_conf_option_t *rhs );
67
68void
69fsd_conf_option_dump( fsd_conf_option_t *option );
70
71
72
73fsd_conf_dict_t *
74fsd_conf_dict_create(void);
75
76void
77fsd_conf_dict_destroy( fsd_conf_dict_t *dict );
78
79fsd_conf_option_t *
80fsd_conf_dict_get( fsd_conf_dict_t *dict, const char *key );
81
82void
83fsd_conf_dict_set(
84                fsd_conf_dict_t *dict, const char *key, fsd_conf_option_t *value
85                );
86
87fsd_conf_dict_t *
88fsd_conf_dict_merge( fsd_conf_dict_t *lhs, fsd_conf_dict_t *rhs );
89
90void
91fsd_conf_dict_dump( fsd_conf_dict_t *dict );
92
93
94/*
95 * Versions of functions above which do not raise exceptions.
96 * Needed in conf_tab.y
97 */
98
99fsd_conf_option_t *
100fsd_conf_option_create_noraise( fsd_conf_type_t type, void *value );
101
102fsd_conf_dict_t *
103fsd_conf_dict_create_noraise(void);
104
105int
106fsd_conf_dict_set_noraise(
107                fsd_conf_dict_t *dict, const char *key, fsd_conf_option_t *value );
108
109#endif /* __DRMAA_UTILS__CONF_H */
110
Note: See TracBrowser for help on using the repository browser.