estar/pdebug.hpp

Go to the documentation of this file.
00001 /* 
00002  * Copyright (C) 2007 Roland Philippsen <roland dot philippsen at gmx net>
00003  * 
00004  * This program is free software; you can redistribute it and/or modify
00005  * it under the terms of the GNU General Public License as published by
00006  * the Free Software Foundation; either version 2 of the License, or
00007  * (at your option) any later version.
00008  * 
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  * 
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00017  * USA
00018  */
00019 
00020 
00021 #ifndef ESTAR_PDEBUG_HPP
00022 #define ESTAR_PDEBUG_HPP
00023 
00050 #include <string>
00051 #include <stdio.h>
00052 
00053 #define PDEBUG_ERR(fmt, arg...) fprintf(stderr, "%s(): "fmt, __func__, ## arg)
00054 #define PDEBUG_OUT(fmt, arg...) fprintf(stdout, "%s(): "fmt, __func__, ## arg)
00055 #define PDEBUG_OFF(fmt, arg...)
00056 
00057 #ifdef ESTAR_VERBOSE_DEBUG
00058 # define ESTAR_DEBUG
00059 # define PVDEBUG PDEBUG_OUT
00060 #else
00061 # define PVDEBUG PDEBUG_OFF
00062 #endif
00063 
00064 #ifdef ESTAR_DEBUG
00065 # include <sstream>
00066 # define PDEBUG PDEBUG_OUT
00067 #else
00068 # define PDEBUG PDEBUG_OFF
00069 #endif
00070   
00071 namespace estar {
00072   
00078   class fakeos {
00079   public:
00080     template<class Foo>
00081     fakeos & operator << (const Foo &) { return * this; }
00082     std::string str() const { return std::string(); }
00083   };
00084   
00085 #ifdef ESTAR_VERBOSE_DEBUG
00086   typedef std::ostringstream vdebugos;
00087 #else
00088   typedef fakeos vdebugos;
00089 #endif
00090   
00091 #ifdef ESTAR_DEBUG
00092   typedef std::ostringstream debugos;
00093 #else
00094   typedef fakeos debugos;
00095 #endif
00096   
00097 }
00098 
00099 #endif // ESTAR_PDEBUG_HPP

doxygen SourceForge.net Logo
E* Interpolated Graph Replanner Wed Dec 12 18:55:40 2007