source: branches/2.0/drmaa2_utils/drmaa_utils/environ.h @ 77

Revision 77, 2.1 KB checked in by mmamonski, 12 years ago (diff)

DRMAA 2.0 utils - first skeleton

RevLine 
[77]1/* $Id: environ.h 13 2011-04-20 15:41:43Z mmamonski $ */
2/*
3 *  PSNC DRMAA 2.0 utilities library
4 *  Copyright (C) 2012  Poznan Supercomputing and Networking Center
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__ENVIRON_H
21#define __DRMAA_UTILS__ENVIRON_H
22
23#ifdef HAVE_CONFIG_H
24#       include <config.h>
25#endif
26
27#include <drmaa_utils/compat.h>
28
29typedef struct fsd_environ_s fsd_environ_t;
30typedef struct fsd_environ_item_s fsd_environ_item_t;
31
32struct fsd_environ_s {
33        void (*
34        destroy)( fsd_environ_t *self );
35
36        const char* (*
37        get)( fsd_environ_t *self, const char *name );
38
39        void (*
40        set)( fsd_environ_t *self, char *name, char *value );
41
42        void (*
43        update)( fsd_environ_t *self, const char *const envp[] );
44
45        char ** (*
46        list)( fsd_environ_t *self );
47
48        /**
49         * Modifies process's environment overwriting variables
50         * set in environ object.
51         * @return  Dictionary of overwritten values.
52         * @see #restore
53         */
54        fsd_environ_t * (*
55        apply)( fsd_environ_t *self );
56
57        /**
58         * Restore process's environment to original state.
59         * All variables from \a self gets overwritten with values
60         * from \a saved_state or unset if variable doesn't exist
61         * in \a saved_state.
62         * @see #apply
63         */
64        void (*
65        restore)( fsd_environ_t *self, fsd_environ_t *saved_state );
66
67        fsd_environ_item_t **_table;
68        unsigned _table_size;
69};
70
71fsd_environ_t *
72fsd_environ_new( const char *const envp[] );
73
74struct fsd_environ_item_s {
75        fsd_environ_item_t *next;
76        char *name;
77        char *value;
78};
79
80#endif /* __DRMAA_UTILS__ENVIRON_H */
81
Note: See TracBrowser for help on using the repository browser.