📄 diag.hpp
字号:
/*This file is part of the FIRE -- Flexible Image Retrieval SystemFIRE is free software; you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation; either version 2 of the License, or(at your option) any later version.FIRE is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with FIRE; if not, write to the Free SoftwareFoundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA*/#ifndef __diag_hpp#define __diag_hpp#include <string>#include <vector>typedef ::std::vector<double> DoubleVector;typedef ::std::vector< DoubleVector* > DoubleVectorVector;typedef ::std::vector<int> IntVector;typedef unsigned int uint;//#include "colors.hpp"/** Library for diagnostic output. @author Nils Springob <nils.springob@crazy-idea.de>, Thomas Deselaers <thomas@deselaers.de> This is a quite efficient and easy way to have some debug messages in your code. It is possible to disable this while run or while compile time in as fine steps as you like. -# while compiletime: to leave all the messages with a debug-level < x out of the programm compile with -DDEBUG_LEVEL=x -# while runtime: set the environment variable to the value you prefer. -# also it is possible to specify this directly in your code using the CheckRuntimeDebugLevel function */#ifndef DEBUG_LEVEL#define DEBUG_LEVEL 0#endif#include <iostream>///simple debug-output macro#define DBGI(level,instruction) \ if(DEBUG_LEVEL>=level && CheckRuntimeDebugLevel(level)) instruction#define DBG(level) \ if(DEBUG_LEVEL>=level && CheckRuntimeDebugLevel(level)) ::std::cout << "(" << ((int)(level)) << ") [" << __FILE__<<":"<<__LINE__<<":"<<__FUNCTION__<<"] "#define BLINK(level) \ if(DEBUG_LEVEL>=level && CheckRuntimeDebugLevel(level)) ::std::cout ///even simpler error-message macro#define ERR ::std::cerr << "[" << __FILE__<<":"<<__LINE__<<":"<<__FUNCTION__<<"] ERROR: "// print variable name and value for use with DBG() etc#define VAR(x) #x " = " << x ///function to specify and check the desired debug levelbool CheckRuntimeDebugLevel(int level, bool set=false);::std::string GetCurrentWorkingDirectory();void printCmdline(uint argc, char **argv);#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -