www.pudn.com > firev0.01.rar > diag.cpp
/* This file is part of the FIRE -- Flexible Image Retrieval System FIRE is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the 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 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with FIRE; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include#include #include #include #include "diag.hpp" using namespace std; namespace diag { // common function, where to place else?? bool CheckRuntimeDebugLevel(int level, bool set) { static int s_Level = -1; if (set) s_Level=level; if (s_Level == -1) { char * p = getenv("DEBUG_LEVEL"); if (p) { string s(p); cout << "DEBUG_LEVEL is " << s << endl; istringstream is(s); is >> s_Level; cout << "DEBUG_LEVEL set to " << s_Level << endl; } } if (s_Level == -1) s_Level=99; return level<=s_Level; } void memtest(void *ptr) { if(ptr==NULL) { ERR << "Memtest failed" << endl; exit(20); } } }