degate  0.1.2
Configuration.cc
Go to the documentation of this file.
00001 /* -*-c++-*-
00002 
00003  This file is part of the IC reverse engineering tool degate.
00004 
00005  Copyright 2008, 2009, 2010 by Martin Schobert
00006 
00007  Degate is free software: you can redistribute it and/or modify
00008  it under the terms of the GNU General Public License as published by
00009  the Free Software Foundation, either version 3 of the License, or
00010  any later version.
00011 
00012  Degate is distributed in the hope that it will be useful,
00013  but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  GNU General Public License for more details.
00016 
00017  You should have received a copy of the GNU General Public License
00018  along with degate. If not, see <http://www.gnu.org/licenses/>.
00019 
00020 */
00021 
00022 #include <Configuration.h>
00023 #include <FileSystem.h>
00024 
00025 #include <boost/lexical_cast.hpp>
00026 
00027 using namespace degate;
00028 
00029 std::string degate::get_temp_directory() {
00030   Configuration const & conf = Configuration::get_instance();
00031   return conf.get_temp_directory();
00032 }
00033 
00034 Configuration::Configuration() {
00035 }
00036 
00037 std::string Configuration::get_temp_directory() const {
00038   char * td = getenv("DEGATE_TEMP_DIR");
00039   if(td == NULL) return get_realpath(std::string("/tmp"));
00040   return get_realpath(std::string(td));
00041 }
00042 
00043 size_t Configuration::get_max_tile_cache_size() const {
00044   char * cs = getenv("DEGATE_CACHE_SIZE");
00045   if(cs == NULL) return 256;
00046   return boost::lexical_cast<size_t>(cs);
00047 }
00048 
00049 std::string Configuration::get_servers_uri_pattern() const {
00050   char * uri_pattern = getenv("DEGATE_SERVER_URI_PATTERN");
00051   if(uri_pattern == NULL) return "http://localhost/cgi-bin/test.pl?channel=%1%";
00052   return uri_pattern;
00053 }