Voreen - Volume Rendering Engine Voreen - Volume Rendering Engine
Voreen - Volume Rendering Engine Westfälische Wilhelms-Universität Münster
  • About
  • Gallery
  • Download
  • Documentation
  • Publications
  • Community

  • Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List

src/core/utils/cmdparser/command_loglevel.cpp

00001 /**********************************************************************
00002  *                                                                    *
00003  * Voreen - The Volume Rendering Engine                               *
00004  *                                                                    *
00005  * Copyright (C) 2005-2010 The Voreen Team. <http://www.voreen.org>   *
00006  *                                                                    *
00007  * This file is part of the Voreen software package. Voreen is free   *
00008  * software: you can redistribute it and/or modify it under the terms *
00009  * of the GNU General Public License version 2 as published by the    *
00010  * Free Software Foundation.                                          *
00011  *                                                                    *
00012  * Voreen 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  * in the file "LICENSE.txt" along with this program.                 *
00019  * If not, see <http://www.gnu.org/licenses/>.                        *
00020  *                                                                    *
00021  * The authors reserve all rights not expressly granted herein. For   *
00022  * non-commercial academic use see the license exception specified in *
00023  * the file "LICENSE-academic.txt". To get information about          *
00024  * commercial licensing please contact the authors.                   *
00025  *                                                                    *
00026  **********************************************************************/
00027 
00028 #include "voreen/core/utils/cmdparser/command_loglevel.h"
00029 
00030 #include "tgt/logmanager.h"
00031 
00032 namespace voreen {
00033 
00034 Command_LogLevel::Command_LogLevel(tgt::LogLevel* dbgLevel)
00035 : Command("--loglevel", "-l", "Sets the verbosity of the tgt::Log", "<debug|warning|info|error|fatal>")
00036 , dbgLevel_(dbgLevel)
00037 {}
00038 
00039 bool Command_LogLevel::execute(const std::vector<std::string>& parameters) {
00040     std::string argument = parameters[0];
00041     if (argument == "debug")
00042         *dbgLevel_ = tgt::Debug;
00043     else if (argument == "warning")
00044         *dbgLevel_ = tgt::Warning;
00045     else if (argument == "info")
00046         *dbgLevel_ = tgt::Info;
00047     else if (argument == "error")
00048         *dbgLevel_ = tgt::Error;
00049     else if (argument == "fatal")
00050         *dbgLevel_ = tgt::Fatal;
00051     else // This case should not happen
00052         return false;
00053 
00054     return true;
00055 }
00056 
00057 bool Command_LogLevel::checkParameters(const std::vector<std::string>& parameters) {
00058     std::set<std::string> set;
00059     set.insert("debug");
00060     set.insert("warning");
00061     set.insert("info");
00062     set.insert("error");
00063     set.insert("fatal");
00064 
00065     return ((parameters.size() == 1) && isValueInSet(parameters[0], set));
00066 }
00067 
00068 } // namespace
  • Getting Started
  • Video Tutorials
  • Build Instructions
  • Adding a Module
  • Programming Tutorials
  • API Documentation
  • FAQ
edit