Gazebo

GazeboMessage.hh

00001 /*
00002  *  Gazebo - Outdoor Multi-Robot Simulator
00003  *  Copyright (C) 2003  
00004  *     Nate Koenig & Andrew Howard
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program; if not, write to the Free Software
00018  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  *
00020  */
00021 /*
00022  * Desc: Gazebo Message
00023  * Author: Nathan Koenig
00024  * Date: 09 June 2007
00025  * SVN info: $Id: GazeboMessage.hh 156 2007-11-26 20:26:57Z natepak $
00026  */
00027 
00028 #ifndef GAZEBOMESSAGE_HH
00029 #define GAZEBOMESSAGE_HH
00030 
00031 #include <iostream>
00032 #include <fstream>
00033 #include <sstream>
00034 
00035 namespace gazebo
00036 {
00037   
00041 
00043   #define gzmsg(level) (gazebo::GazeboMessage::Instance()->Msg(level) << "[" << __FILE__ << ":" << __LINE__ << "]\n  ")
00044  
00046   #define gzlog() (gazebo::GazeboMessage::Instance()->Log() << "[" << __FILE__ << ":" << __LINE__ << "] ")
00047   
00048     class XMLConfigNode;
00049   
00052 
00063   class GazeboMessage
00064   {
00066     public: GazeboMessage();
00067   
00069     public: virtual ~GazeboMessage();
00070   
00072     public: static GazeboMessage *Instance();
00073   
00075     public: void Load(XMLConfigNode *node);
00076   
00079     public: void SetVerbose( int level );
00080   
00083     public: std::ostream &Msg( int level = 0 );
00084   
00086     public: std::ofstream &Log();
00087   
00089     private: int level;
00090   
00091     private: std::ostringstream nullStream;
00092     private: std::ostream *msgStream;
00093     private: std::ofstream logStream;
00094   
00096     private: static GazeboMessage *myself;
00097   };
00098 
00100 }
00101 
00102 #endif

Last updated Aug 04 2007