dlvhex
2.5.0
|
00001 /* dlvhex -- Answer-Set Programming with external interfaces. 00002 * Copyright (C) 2005-2007 Roman Schindlauer 00003 * Copyright (C) 2006-2015 Thomas Krennwallner 00004 * Copyright (C) 2009-2016 Peter Schüller 00005 * Copyright (C) 2011-2016 Christoph Redl 00006 * Copyright (C) 2015-2016 Tobias Kaminski 00007 * Copyright (C) 2015-2016 Antonius Weinzierl 00008 * 00009 * This file is part of dlvhex. 00010 * 00011 * dlvhex is free software; you can redistribute it and/or modify it 00012 * under the terms of the GNU Lesser General Public License as 00013 * published by the Free Software Foundation; either version 2.1 of 00014 * the License, or (at your option) any later version. 00015 * 00016 * dlvhex is distributed in the hope that it will be useful, but 00017 * WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00019 * Lesser General Public License for more details. 00020 * 00021 * You should have received a copy of the GNU Lesser General Public 00022 * License along with dlvhex; if not, write to the Free Software 00023 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 00024 * 02110-1301 USA 00025 */ 00026 00036 #ifdef HAVE_CONFIG_H 00037 #include "config.h" 00038 #endif // HAVE_CONFIG_H 00039 00040 #include "dlvhex2/Configuration.h" 00041 00042 #include <iostream> 00043 #include <stdexcept> 00044 #include <cassert> 00045 00046 DLVHEX_NAMESPACE_BEGIN 00047 00048 Configuration::Configuration() 00049 { 00050 // 00051 // program analysis 00052 // 00053 verboseLevel[DUMP_PARSED_PROGRAM] = 1; 00054 verboseLevel[DUMP_DEPENDENCY_GRAPH] = 1; 00055 verboseLevel[SAFETY_ANALYSIS] = 1; 00056 00057 // 00058 // plugin processing 00059 // 00060 verboseLevel[DUMP_CONVERTED_PROGRAM] = 2; 00061 verboseLevel[DUMP_REWRITTEN_PROGRAM] = 2; 00062 verboseLevel[DUMP_OPTIMIZED_PROGRAM] = 2; 00063 verboseLevel[PLUGIN_LOADING] = 4; 00064 00065 // 00066 // intermediate model generation 00067 // 00068 verboseLevel[COMPONENT_EVALUATION] = 4; 00069 verboseLevel[MODEL_GENERATOR] = 4; 00070 verboseLevel[GRAPH_PROCESSOR] = 4; 00071 verboseLevel[DUMP_OUTPUT] = 4; 00072 00073 // 00074 // time benchmarking 00075 // 00076 verboseLevel[PROFILING] = 8; 00077 } 00078 00079 00080 unsigned 00081 Configuration::getOption(const std::string& option) const 00082 { 00083 if( optionMap.find(option) == optionMap.end() ) 00084 throw std::runtime_error("requested non-existing/unset option '"+option+"'"); 00085 return optionMap.at(option); 00086 } 00087 00088 00089 bool 00090 Configuration::doVerbose(verboseAction_t va) 00091 { 00092 // 00093 // bitwise and 00094 // 00095 return (this->getOption("Verbose") & verboseLevel[va]) != 0; 00096 } 00097 00098 00099 void 00100 Configuration::setOption(const std::string& option, unsigned value) 00101 { 00102 optionMap[option] = value; 00103 } 00104 00105 00106 void 00107 Configuration::addFilter(const std::string& f) 00108 { 00109 optionFilter.push_back(f); 00110 } 00111 00112 00113 const std::vector<std::string>& 00114 Configuration::getFilters() const 00115 { 00116 return optionFilter; 00117 } 00118 00119 00120 const std::string& 00121 Configuration::getStringOption( 00122 const std::string& key) const 00123 { 00124 std::map<std::string, std::string>::const_iterator it = 00125 stringOptionMap.find(key); 00126 assert(it != stringOptionMap.end()); 00127 return it->second; 00128 } 00129 00130 00131 void Configuration::setStringOption( 00132 const std::string& key, const std::string& value) 00133 { 00134 stringOptionMap[key] = value; 00135 } 00136 00137 00138 DLVHEX_NAMESPACE_END 00139 00140 00141 // vim:expandtab:ts=4:sw=4: 00142 // mode: C++ 00143 // End: