Go to the documentation of this file.00001 #ifndef OPENTISSUE_UTILITY_UTILITY_GET_ENVIRONMENT_VARIABLE_H
00002 #define OPENTISSUE_UTILITY_UTILITY_GET_ENVIRONMENT_VARIABLE_H
00003
00004
00005
00006
00007
00008
00009
00010 #include <OpenTissue/configuration.h>
00011
00012 #include <stdexcept>
00013
00014 #include <cstdlib>
00015 #include <string>
00016 #include <cassert>
00017
00018 namespace OpenTissue
00019 {
00020 namespace utility
00021 {
00022
00031 inline std::string get_environment_variable(std::string const & name)
00032 {
00033 char * value = getenv( name.c_str() );
00034 if(value)
00035 return std::string( value );
00036 throw std::logic_error("get_environment_variable(): the specified environment variable was not set");
00037 }
00038
00039 }
00040
00041 }
00042
00043
00044 #endif