casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
EnvVar.h
Go to the documentation of this file.
00001 //# EnvVar.h: Environment variables class
00002 //# Copyright (C) 1993,1994,1995,1999,2002
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //# 
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //# 
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //# 
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //# 
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //# $Id: EnvVar.h 20551 2009-03-25 00:11:33Z Malte.Marquarding $
00027 
00028 #ifndef CASA_ENVVAR_H
00029 #define CASA_ENVVAR_H
00030 
00031 #include <casa/aips.h>
00032 #include <casa/BasicSL/String.h>
00033 
00034 namespace casa { //# NAMESPACE CASA - BEGIN
00035 
00036 // <summary>
00037 // This class allows for getting enviroment variables
00038 // </summary>
00039 
00040 // <use visibility=export>
00041 // <reviewed reviewer="Paul Shannon" date="1995/02/08" tests="tEnvVar" demos="">
00042 
00043 // <synopsis> 
00044 // Environment variables are familiar to every Unix, MSDOS and VMS
00045 // computer user.  This class makes it convenient to get and
00046 // enquire about environment variables from within a C++ program.
00047 // </synopsis> 
00048 
00049 // <example>
00050 // Check if an environment variable is defined.
00051 // If so, get its value.
00052 // <srcblock>
00053 //  if (EnvironmentVariable::isDefined ("PATH")) {
00054 //    cout << EnvironmentVariable::get ("PATH") << endl;
00055 //  }
00056 // </srcblock>
00057 // </example>
00058 
00059 // <todo asof=1994/02/08>
00060 // </todo>
00061 
00062 class EnvironmentVariable
00063 {
00064 public:
00065   // Is environment variable with given name defined? 
00066   static Bool isDefined (const String& name);
00067 
00068   // Get the value of environment variable with given name.
00069   // If not defined, return an empty String.
00070   static String get (const String& name);
00071 
00072   // Define environment variable.
00073   // If it already exists, its value will be overwritten.
00074   static void set (const String& name, const String& value);
00075 
00076 private:
00077   // This class is not meant to be constructed.
00078   EnvironmentVariable();
00079 };
00080 
00081 
00082 
00083 } //# NAMESPACE CASA - END
00084 
00085 #endif
00086