casacore
Loading...
Searching...
No Matches
EnvVar.h
Go to the documentation of this file.
1// # EnvVar.h: Environment variables class
2// # Copyright (C) 1993,1994,1995,1999,2002
3// # Associated Universities, Inc. Washington DC, USA.
4// #
5// # This library is free software; you can redistribute it and/or modify it
6// # under the terms of the GNU Library General Public License as published by
7// # the Free Software Foundation; either version 2 of the License, or (at your
8// # option) any later version.
9// #
10// # This library is distributed in the hope that it will be useful, but WITHOUT
11// # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12// # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13// # License for more details.
14// #
15// # You should have received a copy of the GNU Library General Public License
16// # along with this library; if not, write to the Free Software Foundation,
17// # Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18// #
19// # Correspondence concerning AIPS++ should be addressed as follows:
20// # Internet email: casa-feedback@nrao.edu.
21// # Postal address: AIPS++ Project Office
22// # National Radio Astronomy Observatory
23// # 520 Edgemont Road
24// # Charlottesville, VA 22903-2475 USA
25
26#ifndef CASA_ENVVAR_H
27#define CASA_ENVVAR_H
28
29#include <casacore/casa/aips.h>
30#include <casacore/casa/BasicSL/String.h>
31
32namespace casacore { // # NAMESPACE CASACORE - BEGIN
33
34// <summary>
35// This class allows for getting enviroment variables
36// </summary>
37
38// <use visibility=export>
39// <reviewed reviewer="Paul Shannon" date="1995/02/08" tests="tEnvVar" demos="">
40
41// <synopsis>
42// Environment variables are familiar to every Unix, MSDOS and VMS
43// computer user. This class makes it convenient to get and
44// enquire about environment variables from within a C++ program.
45// </synopsis>
46
47// <example>
48// Check if an environment variable is defined.
49// If so, get its value.
50// <srcblock>
51// if (EnvironmentVariable::isDefined ("PATH")) {
52// cout << EnvironmentVariable::get ("PATH") << endl;
53// }
54// </srcblock>
55// </example>
56
57// <todo asof=1994/02/08>
58// </todo>
59
61 public:
62 // Is environment variable with given name defined?
63 static Bool isDefined(const String& name);
64
65 // Get the value of environment variable with given name.
66 // If not defined, return an empty String.
67 static String get(const String& name);
68
69 // Define environment variable.
70 // If it already exists, its value will be overwritten.
71 static void set(const String& name, const String& value);
72
73 private:
74 // This class is not meant to be constructed.
76};
77
78} // namespace casacore
79
80#endif
static void set(const String &name, const String &value)
Define environment variable.
EnvironmentVariable()
This class is not meant to be constructed.
static String get(const String &name)
Get the value of environment variable with given name.
static Bool isDefined(const String &name)
Is environment variable with given name defined?
String: the storage and methods of handling collections of characters.
Definition String.h:355
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
String name() const
Return the name of the field.
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
NewDelAllocator< T > NewDelAllocator< T >::value
Definition Allocator.h:360