Revision: 4453
          http://playerstage.svn.sourceforge.net/playerstage/?rev=4453&view=rev
Author:   robotos
Date:     2008-03-28 02:31:36 -0700 (Fri, 28 Mar 2008)

Log Message:
-----------
Changes in the messaging system.
As we are lazy and will not populate the code with gzlog() calls, add support 
for
autologging of messages and errors. 
This turn out to be more difficult that it seemed, so I change the class and 
the calls.
Take advantage of that to make the same with gzthrow()
now calling to that method is far easier.

Changes all over the code to accomodate/take advantage of the changes.

Modified Paths:
--------------
    code/gazebo/trunk/server/GazeboError.hh
    code/gazebo/trunk/server/GazeboMessage.cc
    code/gazebo/trunk/server/GazeboMessage.hh
    code/gazebo/trunk/server/Global.hh
    code/gazebo/trunk/server/Model.cc
    code/gazebo/trunk/server/Simulator.cc
    code/gazebo/trunk/server/World.cc
    code/gazebo/trunk/server/XMLConfig.cc
    code/gazebo/trunk/server/controllers/Controller.cc
    code/gazebo/trunk/server/controllers/factory/Factory.cc
    code/gazebo/trunk/server/physics/Body.cc
    code/gazebo/trunk/server/physics/HeightmapGeom.cc
    code/gazebo/trunk/server/rendering/OgreAdaptor.cc
    code/gazebo/trunk/server/rendering/OgreCreator.cc
    code/gazebo/trunk/server/rendering/OgreVisual.cc
    code/gazebo/trunk/server/sensors/Sensor.cc
    code/gazebo/trunk/server/sensors/camera/MonoCameraSensor.cc
    code/gazebo/trunk/server/sensors/camera/StereoCameraSensor.cc

Modified: code/gazebo/trunk/server/GazeboError.hh
===================================================================
--- code/gazebo/trunk/server/GazeboError.hh     2008-03-28 07:45:25 UTC (rev 
4452)
+++ code/gazebo/trunk/server/GazeboError.hh     2008-03-28 09:31:36 UTC (rev 
4453)
@@ -34,27 +34,32 @@
 
 namespace gazebo
 {
-  
   /// \addtogroup gazebo_server
   /// \brief Gazebo error class
   /// \{
 
+  //TODO: global variable, static in the class would be better, if only the 
linker didn't oppose to it ...
+  static std::ostringstream throwStream;
   /// Throw an error
-  #define gzthrow(msg) throw 
gazebo::GazeboError(__FILE__,__LINE__,std::string(msg))
+  #define gzthrow(msg) throwStream << "Exception: " << msg << std::endl << 
std::flush;\
+                       throw 
gazebo::GazeboError(__FILE__,__LINE__,throwStream.str())
+
   
   /// \brief Class to handle errors
   ///
   /**
-   Use <tt>gzthrow(std::string)</tt> to throw errors.
+   Use <tt>gzthrow(data1 << data2)</tt> to throw errors.
 
    Example:
    
    \verbatim
+   Recommended new way:
+   gzthrow("This is an error message of type[" << type << "]");
+   Old way:
    std::ostringstream stream;
    stream << "This is an error message of type[" << type << "]\n";
    gzthrow(stream.str());
-   or if type is a string, simply:
-   gzthrow("This is an error message of type[" + type + "]\n");
+   The final "\n" is not needed anymore, the code should be changed to the new 
type.
    \endverbatim
 
   */
@@ -86,7 +91,7 @@
     /// \brief Return the error string
     /// \return The error string
     public: std::string GetErrorStr() const; 
-  
+
     /// \brief The error function
     private: std::string file;
   

Modified: code/gazebo/trunk/server/GazeboMessage.cc
===================================================================
--- code/gazebo/trunk/server/GazeboMessage.cc   2008-03-28 07:45:25 UTC (rev 
4452)
+++ code/gazebo/trunk/server/GazeboMessage.cc   2008-03-28 09:31:36 UTC (rev 
4453)
@@ -38,10 +38,7 @@
 /// Default constructor
 GazeboMessage::GazeboMessage()
 {
-  this->msgStream = &std::cout;
-  this->errStream = &std::cerr;
-
-  this->level = 0;
+  this->level = 2;
 }
 
 
////////////////////////////////////////////////////////////////////////////////
@@ -70,7 +67,7 @@
     gzthrow("Null XMLConfig node");
   }
 
-  this->SetVerbose(node->GetInt("verbosity",0,0));
+  this->SetVerbose(node->GetInt("verbosity",2,0));
   this->logData = node->GetBool("logData",false);
 
   if (this->logData)
@@ -99,17 +96,6 @@
 {
   node->SetValue("verbosity", this->level);
   node->SetValue("logData", this->logData);
-
-  /*
-    node->NewElement("verbosity", String(this->level)); //std::ostringstream 
<< this->level);
-
-    node->NewElement("logData", gazebo::String(this->logData));
-
-    if (this->logData)
-      node->NewElement("logData", std::ostringstream << "true");
-    else
-      node->NewElement("logData", std::ostringstream << "true");
-    */
 }
 
 
////////////////////////////////////////////////////////////////////////////////
@@ -121,24 +107,22 @@
 
 
////////////////////////////////////////////////////////////////////////////////
 /// Get the message stream
-std::ostream &GazeboMessage::Msg( int msglevel )
+void GazeboMessage::Msg( int msglevel, std::string msg )
 {
-  if (msglevel <= this->level)
-    return *this->msgStream;
-  else
-    return this->nullStream;
-}
 
-////////////////////////////////////////////////////////////////////////////////
-/// Get the error stream
-std::ostream &GazeboMessage::Err( int msglevel )
-{
-  if (msglevel <= this->level)
-    return *this->errStream;
+  if (msglevel >= this->level)
+    return;
+
+  if (msglevel <0)
+    std::cerr << msg;
   else
-    return this->nullStream;
+    std::cout << msg;
+
+  if (this->logData)
+    this->Log() << msg;
 }
 
+
 
////////////////////////////////////////////////////////////////////////////////
 // Log a message
 std::ofstream &GazeboMessage::Log()

Modified: code/gazebo/trunk/server/GazeboMessage.hh
===================================================================
--- code/gazebo/trunk/server/GazeboMessage.hh   2008-03-28 07:45:25 UTC (rev 
4452)
+++ code/gazebo/trunk/server/GazeboMessage.hh   2008-03-28 09:31:36 UTC (rev 
4453)
@@ -32,37 +32,51 @@
 #include <fstream>
 #include <string>
 #include <sstream>
+#include "XMLConfig.hh" 
 
 namespace gazebo
 {
   
+  class XMLConfigNode;
   /// \addtogroup gazebo_server
   /// \brief Gazebo message class
   /// \{
-
+  
   /// Output a message
-  #define gzmsg(level) (gazebo::GazeboMessage::Instance()->Msg(level) << "[" 
<< __FILE__ << ":" << __LINE__ << "]\n  ")
+  static std::ostringstream messageStream;
+  
+  #define gzmsg(level, msg) messageStream <<  "[" << __FILE__ << ":" << 
__LINE__ << "]\n" << msg << std::endl << std::flush;\
+                             gazebo::GazeboMessage::Instance()->Msg(level, 
messageStream.str()) 
+  #define gzerr(msg) gzmsg (-1, msg)
+ 
+/*
+* */
 
-  #define gzerr(level) (gazebo::GazeboMessage::Instance()->Err(level) << 
"Error: [" << __FILE__ << ":" << __LINE__ << "]\n  ")
- 
-  /// Log a message
-  #define gzlog() (gazebo::GazeboMessage::Instance()->Log() << "[" << __FILE__ 
<< ":" << __LINE__ << "] ")
+  /// Log a message : not used so far but who knows
+  #define gzlog() (gazebo::GazeboMessage::Instance()->Log() << "[" << __FILE__ 
<< ":" << __LINE__ << "]\n ")
   
-    class XMLConfigNode;
- 
+  
   /// \brief Gazebo class for outputings messages
   ///
   /**
-   Use <tt>gzmsg(level)</tt> as an ostream to output messages, where level is 
+   Use <tt>gzmsg(level, msg)</tt> being msg an ostream to output messages, 
where level is 
    an integer priority level.
 
    Example:
    
    \verbatim
-   gzmsg(0) << "This is an important message";
-   gzmsg(2) << "This is a less important message";
+   gzmsg(0, "This is an important message");
+   gzmsg(2, "This is a less important message");
    \endverbatim
-  */
+ 
+   Currently levels correspond roughly to this:
+   -1 : errors that makes Gazebo finish (can't find a bsp, a model, etc.)
+    0 : errors that affect how Gazebo works (can't find a texture, etc.)
+    1 : General information (Gui Initialized)
+    2 : Verbose information / Debugging 
+
+   gzerr is equivalent to gzmsg(-1)
+   */
   class GazeboMessage
   {
     /// \brief Default constructor
@@ -86,11 +100,11 @@
   
     /// \brief Use this to output a message to the terminal
     /// \param level Level of the message
-    public: std::ostream &Msg( int level = 0 );
+    public: void Msg( int level, std::string msg );
 
     /// \brief Use this to output an error to the terminal
     /// \param level Level of the message
-    public: std::ostream &Err( int level = 0 );
+//    public: std::ostream &Err( int level = 0 );
   
     /// \brief Use this to output a message to a log file
     public: std::ofstream &Log();
@@ -101,11 +115,8 @@
     /// \brief True if logging data
     private: bool logData;
   
-    private: std::ostringstream nullStream;
-    private: std::ostream *msgStream;
-    private: std::ostream *errStream;
+    /// \brief The logstream 
     private: std::ofstream logStream;
-  
     /// Pointer to myself
     private: static GazeboMessage *myself;
   };
@@ -113,4 +124,6 @@
   /// \}
 }
 
+
+
 #endif

Modified: code/gazebo/trunk/server/Global.hh
===================================================================
--- code/gazebo/trunk/server/Global.hh  2008-03-28 07:45:25 UTC (rev 4452)
+++ code/gazebo/trunk/server/Global.hh  2008-03-28 09:31:36 UTC (rev 4453)
@@ -33,7 +33,9 @@
 
 #include <list>
 #include <math.h>
+#include <sstream>
 
+
 #include "Pose3d.hh"
 #include "GazeboError.hh"
 #include "GazeboMessage.hh"
@@ -116,7 +118,6 @@
   */  
   class Global
   {
-
     /// Paths gazebo install
     public: static std::list<std::string> gazeboPaths;
 

Modified: code/gazebo/trunk/server/Model.cc
===================================================================
--- code/gazebo/trunk/server/Model.cc   2008-03-28 07:45:25 UTC (rev 4452)
+++ code/gazebo/trunk/server/Model.cc   2008-03-28 09:31:36 UTC (rev 4453)
@@ -455,7 +455,7 @@
 
   // Store this body
   if (this->bodies[body->GetName()])
-    gzmsg(0) << "Body with name[" << body->GetName() << "] already exists!!\n";
+    gzmsg(0, "Body with name[" << body->GetName() << "] already exists!!");
 
   // Store the pointer to this body
   this->bodies[body->GetName()] = body;
@@ -557,8 +557,7 @@
     }
     catch (GazeboError e)
     {
-      std::cerr << "Error Loading Controller[" <<  controllerName
-      << "]\n" << e << std::endl;
+      gzerr("Error Loading Controller[" <<  controllerName << "]\n" << e) ;
       delete controller;
       return;
     }
@@ -568,7 +567,7 @@
   }
   else
   {
-    gzmsg(0) << "Unknown controller[" << controllerType << "]\n";
+    gzmsg(0, "Unknown controller[" << controllerType << "]");
   }
 }
 
@@ -685,8 +684,7 @@
     }
     catch (GazeboError e)
     {
-      std::cerr << "Error Loading body[" << 
childNode->GetString("name",std::string(), 0) << "]\n";
-      std::cerr <<  e << std::endl;
+      gzmsg(0,"Error Loading body[" << 
childNode->GetString("name",std::string(), 0) << "]\n" << e );
       childNode = childNode->GetNextByNSPrefix("body");
       continue;
     }
@@ -704,8 +702,7 @@
     }
     catch (GazeboError e)
     {
-      std::cerr << "Error Loading Joint[" << childNode->GetString("name", 
std::string(), 0) << "]\n";
-      std::cerr <<  e << std::endl;
+      gzmsg(0,"Error Loading Joint[" << 
childNode->GetString("name",std::string(), 0) << "]\n" << e );
       childNode = childNode->GetNextByNSPrefix("joint");
       continue;
     }

Modified: code/gazebo/trunk/server/Simulator.cc
===================================================================
--- code/gazebo/trunk/server/Simulator.cc       2008-03-28 07:45:25 UTC (rev 
4452)
+++ code/gazebo/trunk/server/Simulator.cc       2008-03-28 09:31:36 UTC (rev 
4453)
@@ -101,17 +101,13 @@
 
   // Load the world file
   this->xmlFile=new gazebo::XMLConfig();
-
   try
   {
     xmlFile->Load(worldFileName);
   }
   catch (GazeboError e)
   {
-    std::ostringstream stream;
-    stream << "The XML config file can not be loaded, please make sure is a 
correct file\n"
-    << e << "\n";
-    gzthrow(stream.str());
+    gzthrow("The XML config file can not be loaded, please make sure is a 
correct file\n" << e); 
   }
 
   XMLConfigNode *rootNode(xmlFile->GetRootNode());
@@ -126,10 +122,7 @@
   }
   catch (GazeboError e)
   {
-    std::ostringstream stream;
-    stream << "Error loading the GUI\n"
-    << e << "\n";
-    gzthrow(stream.str());
+    gzthrow( "Error loading the GUI\n" << e);
   }
 
   //Initialize RenderingEngine
@@ -139,11 +132,8 @@
   }
   catch (gazebo::GazeboError e)
   {
-    std::ostringstream stream;
-    stream << "Failed to Initialize the OGRE Rendering system\n"
-    << e << "\n";
-    gzthrow(stream.str());
-  }
+    gzthrow("Failed to Initialize the OGRE Rendering system\n" << e );
+ }
 
   //Preload basic shapes that can be used anywhere
   OgreCreator::CreateBasicShapes();
@@ -155,10 +145,7 @@
   }
   catch (GazeboError e)
   {
-    std::ostringstream stream;
-    stream << "Error loading the GUI\n"
-    << e << "\n";
-    gzthrow(stream.str());
+    gzthrow("Failed to load the GUI\n"  << e);
   }
 
   this->loaded=true;
@@ -178,10 +165,8 @@
 
   if (xmlFile->Save(filename)<0)
   {
-    std::ostringstream stream;
-    stream << "The XML file coult not be written back to " << filename << 
std::endl;
-    gzthrow(stream.str());
-  }
+   gzthrow("The XML file could not be written back to " << filename );
+   }
 }
 
 
@@ -377,7 +362,7 @@
     int y = childNode->GetTupleInt("pos",1,0);
     std::string type = childNode->GetString("type","fltk",1);
 
-    gzmsg(1) << "Creating GUI:\n\tType[" << type << "] Pos[" << x << " " << y 
<< "] Size[" << width << " " << height << "]\n";
+    gzmsg(1, "Creating GUI:\n\tType[" << type << "] Pos[" << x << " " << y << 
"] Size[" << width << " " << height << "]");
     if (type != "fltk")
     {
       gzthrow("The only GUI available is 'fltk', for no-GUI simulation, delete 
the 'gui' tag and its children");
@@ -393,7 +378,7 @@
   else
   {
     // Create a dummy GUI
-    gzmsg(1) << "Creating a dummy GUI\n";
+    gzmsg(1, "Creating a dummy GUI");
     this->gui = GuiFactory::NewGui(std::string("dummy"), 0, 0, 0, 0, 
std::string());
   }
 }

Modified: code/gazebo/trunk/server/World.cc
===================================================================
--- code/gazebo/trunk/server/World.cc   2008-03-28 07:45:25 UTC (rev 4452)
+++ code/gazebo/trunk/server/World.cc   2008-03-28 09:31:36 UTC (rev 4453)
@@ -230,7 +230,7 @@
   }
   catch (std::string e)
   {
-    gzmsg(-1) << "Problem destroying simIface[" << e << "]\n";
+    gzmsg(-1, "Problem destroying simIface[" << e << "]");
   }
 
   this->server->Fini();
@@ -575,7 +575,7 @@
       }
       else
       {
-        gzmsg(-1) << "Simulation Iface: Model[" << 
this->simIface->data->model_name << "] does not exist\n";
+        gzmsg(-1, "Simulation Iface: Model[" << 
this->simIface->data->model_name << "] does not exist");
       }
 
       strcpy((char*)this->simIface->data->model_name, "");

Modified: code/gazebo/trunk/server/XMLConfig.cc
===================================================================
--- code/gazebo/trunk/server/XMLConfig.cc       2008-03-28 07:45:25 UTC (rev 
4452)
+++ code/gazebo/trunk/server/XMLConfig.cc       2008-03-28 09:31:36 UTC (rev 
4453)
@@ -65,7 +65,6 @@
 // Load world from file
 void XMLConfig::Load( const std::string &filename )
 {
-  std::ostringstream stream;
   this->filename = filename;
 
   // Enable line numbering
@@ -75,8 +74,7 @@
   this->xmlDoc = xmlParseFile( this->filename.c_str() );
   if (xmlDoc == NULL)
   {
-    stream << "Unable to parse xml file: " << this->filename;
-    gzthrow(stream.str());
+    gzthrow( "Unable to parse xml file: " << this->filename);
   }
 
   // Create xpath evaluation context
@@ -97,8 +95,7 @@
   this->root = this->CreateNodes( NULL, xmlDocGetRootElement(this->xmlDoc) );
   if (this->root == NULL)
   {
-    stream << "Empty document [" << this->filename << "]";
-    gzthrow(stream.str());
+    gzthrow( "Empty document [" << this->filename << "]");
   }
 }
 
@@ -111,9 +108,7 @@
   this->xmlDoc = xmlParseDoc( (xmlChar*)(str.c_str()) );
   if (xmlDoc == NULL)
   {
-    std::ostringstream stream;
-    stream << "unable to parse [" << str << "]";
-    gzthrow(stream.str());
+    gzthrow("unable to parse [" << str << "]");
   }
 
   // Create wrappers for all the nodes (recursive)
@@ -122,9 +117,7 @@
 
   if (this->root == NULL)
   {
-    std::ostringstream stream;
-    stream << "Empty document [" << str << "\n";
-    gzthrow(stream.str());
+    gzthrow( "Empty document [" << str<< "]") ;
   }
 }
 
@@ -409,8 +402,7 @@
 {
   XMLConfigNode *node;
 
-  std::cout << "name = [" << (const char*) this->xmlNode->name
-  << "]\n";
+  gzmsg(2, "name = [" << (const char*) this->xmlNode->name << "]");
 
   // Recurse
   for (node = this->childFirst; node != NULL; node = node->next)
@@ -482,9 +474,7 @@
 
   if (!value && require)
   {
-    std::ostringstream stream;
-    stream << "unable to find required string attribute[" << key << "] in 
world file node[" << this->GetName() << "]";
-    gzthrow(stream.str());
+    gzthrow( "unable to find required string attribute[" << key << "] in world 
file node[" << this->GetName() << "]");
   }
   else if ( !value )
     return def;
@@ -501,9 +491,7 @@
 
   if (!value && require)
   {
-    std::ostringstream stream;
-    stream << "unable to find required char attribute[" << key << "] in world 
file node[" << this->GetName() << "]";
-    gzthrow(stream.str());
+    gzthrow("unable to find required char attribute[" << key << "] in world 
file node[" << this->GetName() << "]");
   }
   else if ( !value )
     return def;
@@ -553,9 +541,7 @@
 
   if (!value && require)
   {
-    std::ostringstream stream;
-    stream << "unable to find required int attribute[" << key << "] in world 
file node[" << this->GetName() << "]";
-    gzthrow(stream.str());
+    gzthrow ("unable to find required int attribute[" << key << "] in world 
file node[" << this->GetName() << "]");
   }
   else if ( !value )
     return def;
@@ -572,9 +558,7 @@
 
   if (!value && require)
   {
-    std::ostringstream stream;
-    stream << "unable to find required double attribute[" << key << "] in 
world file node[" << this->GetName() << "]";
-    gzthrow(stream.str());
+    gzthrow( "unable to find required double attribute[" << key << "] in world 
file node[" << this->GetName() << "]");
   }
   else if ( !value )
     return def;
@@ -590,9 +574,7 @@
 
   if (!value && require)
   {
-    std::ostringstream stream;
-    stream << "unable to find required float attribute[" << key << "] in world 
file node[" << this->GetName() << "]";
-    gzthrow(stream.str());
+    gzthrow( "unable to find required float attribute[" << key << "] in world 
file node[" << this->GetName() << "]");
   }
   else if ( !value )
     return def;
@@ -611,9 +593,7 @@
   if (!value && require)
   {
     xmlFree(value);
-    std::ostringstream stream;
-    stream << "unable to find required bool attribute[" << key << "] in world 
file node[" << this->GetName() << "]";
-    gzthrow(stream.str());
+    gzthrow( "unable to find required bool attribute[" << key << "] in world 
file node[" << this->GetName() << "]");
   }
   else if ( !value )
   {
@@ -925,9 +905,7 @@
     newNode = xmlNewNode(0, (xmlChar*) key); //I hope we don't need namespaces 
here
     if (!newNode)
     {
-      std::ostringstream stream;
-      stream << "unable to create an element [" << key << "] in world file 
node[" << this->GetName() << "]";
-      gzthrow(stream.str());
+      gzthrow( "unable to create an element [" << key << "] in world file 
node[" << this->GetName() << "]");
     }
     xmlNodeSetContent(newNode, (xmlChar*) value);
     xmlAddChild(this->xmlNode, newNode);

Modified: code/gazebo/trunk/server/controllers/Controller.cc
===================================================================
--- code/gazebo/trunk/server/controllers/Controller.cc  2008-03-28 07:45:25 UTC 
(rev 4452)
+++ code/gazebo/trunk/server/controllers/Controller.cc  2008-03-28 09:31:36 UTC 
(rev 4453)
@@ -90,7 +90,7 @@
     }
     catch (...) //TODO: Show the exception text here (subclass exception?)
     {
-      gzmsg(1) << "No manager for the interface " << ifaceType << " found. 
Disabled.\n";
+      gzmsg(0, "No manager for the interface " << ifaceType << " found. 
Disabled.");
       childNode = childNode->GetNextByNSPrefix("interface");
       continue;
     }
@@ -105,9 +105,7 @@
 
   if (this->ifaces.size() <= 0)
   {
-    std::ostringstream stream;
-    stream << "No interface defined for " << this->name << " controller";
-    gzthrow(stream.str());
+    gzthrow( "No interface defined for " << this->name << " controller");
   }
 
   this->LoadChild(node);

Modified: code/gazebo/trunk/server/controllers/factory/Factory.cc
===================================================================
--- code/gazebo/trunk/server/controllers/factory/Factory.cc     2008-03-28 
07:45:25 UTC (rev 4452)
+++ code/gazebo/trunk/server/controllers/factory/Factory.cc     2008-03-28 
09:31:36 UTC (rev 4453)
@@ -100,7 +100,7 @@
     }
     catch (gazebo::GazeboError e)
     {
-      std::cerr << "The controlled factory could not load its XML data [" << e 
<< "]\n";
+      gzerr("The controlled factory could not load its XML data [" << e << 
"]");
       return;
     }
 

Modified: code/gazebo/trunk/server/physics/Body.cc
===================================================================
--- code/gazebo/trunk/server/physics/Body.cc    2008-03-28 07:45:25 UTC (rev 
4452)
+++ code/gazebo/trunk/server/physics/Body.cc    2008-03-28 09:31:36 UTC (rev 
4453)
@@ -549,7 +549,7 @@
 {
   if (!this->bodyId)
   {
-    gzmsg(0) << "Invalid ODE body\n";
+    gzmsg(0, "Set velocity to an invalid ODE body");
   }
   else
     dBodySetLinearVel(this->bodyId, vel.x, vel.y, vel.z);
@@ -564,7 +564,7 @@
 
   if (!this->bodyId)
   {
-    gzmsg(0) << "Invalid ODE body\n";
+    gzmsg(0, "Invalid ODE body");
     return vel;
   }
 
@@ -583,7 +583,7 @@
 {
   if (!this->bodyId)
   {
-    gzmsg(0) << "Invalid ODE body\n";
+    gzmsg(0, "Invalid ODE body");
   }
   else
     dBodySetAngularVel(this->bodyId, vel.x, vel.y, vel.z);
@@ -598,7 +598,7 @@
 
   if (!this->bodyId)
   {
-    gzmsg(0) << "Invalid ODE body\n";
+    gzmsg(0, "Invalid ODE body");
     return vel;
   }
 
@@ -616,7 +616,7 @@
 {
   if (!this->bodyId)
   {
-    gzmsg(0) << "Invalid ODE body\n";
+    gzmsg(0, "Invalid ODE body");
   }
   else
     dBodySetForce(this->bodyId, force.x, force.y, force.z);
@@ -631,7 +631,7 @@
 
   if (!this->bodyId)
   {
-    gzmsg(0) << "Invalid ODE body\n";
+    gzmsg(0, "Invalid ODE body");
     return force;
   }
 
@@ -650,7 +650,7 @@
 {
   if (!this->bodyId)
   {
-    gzmsg(0) << "Invalid ODE body\n";
+    gzmsg(0, "Invalid ODE body");
   }
   else
     dBodySetTorque(this->bodyId, torque.x, torque.y, torque.z);
@@ -665,7 +665,7 @@
 
   if (!this->bodyId)
   {
-    gzmsg(0) << "Invalid ODE body\n";
+    gzmsg(0, "Invalid ODE body");
     return torque;
   }
 

Modified: code/gazebo/trunk/server/physics/HeightmapGeom.cc
===================================================================
--- code/gazebo/trunk/server/physics/HeightmapGeom.cc   2008-03-28 07:45:25 UTC 
(rev 4452)
+++ code/gazebo/trunk/server/physics/HeightmapGeom.cc   2008-03-28 09:31:36 UTC 
(rev 4453)
@@ -30,6 +30,7 @@
 #include <string.h>
 
 #include "GazeboError.hh"
+#include "GazeboMessage.hh"
 #include "OgreAdaptor.hh"
 #include "Global.hh"
 #include "Body.hh"
@@ -174,7 +175,7 @@
 
   std::ostringstream stream;
 
-  std::cout << "Terrain Image[" << this->terrainImage << "] Size[" << 
this->terrainSize << "]\n";
+  gzmsg(2, "Terrain Image[" << this->terrainImage << "] Size[" << 
this->terrainSize << "]");
 
   stream << "WorldTexture=" << worldTexture << "\n";
   //The detail texture

Modified: code/gazebo/trunk/server/rendering/OgreAdaptor.cc
===================================================================
--- code/gazebo/trunk/server/rendering/OgreAdaptor.cc   2008-03-28 07:45:25 UTC 
(rev 4452)
+++ code/gazebo/trunk/server/rendering/OgreAdaptor.cc   2008-03-28 09:31:36 UTC 
(rev 4453)
@@ -193,7 +193,8 @@
     this->sceneMgr->setShadowTechnique( Ogre::SHADOWTYPE_TEXTURE_ADDITIVE );
   else if (shadowTechnique == std::string("none"))
     this->sceneMgr->setShadowTechnique( Ogre::SHADOWTYPE_NONE );
-  else gzthrow(std::string("Unsupported shadow technique: ") + shadowTechnique 
+ "\n");
+  else 
+    gzthrow("Unsupported shadow technique:\n" << shadowTechnique);
 
   this->sceneMgr->setShadowTextureSelfShadow(true);
   this->sceneMgr->setShadowTextureSize(node->GetInt("shadowTextureSize", 512));
@@ -234,7 +235,7 @@
     }
     catch (Ogre::Exception e)
     {
-      gzmsg(0) << "Unable to load BSP geometry." << e.getDescription() << "\n";
+      gzmsg(-1, "Unable to load BSP geometry." << e.getDescription()) ;
       exit(0);
     }
   }

Modified: code/gazebo/trunk/server/rendering/OgreCreator.cc
===================================================================
--- code/gazebo/trunk/server/rendering/OgreCreator.cc   2008-03-28 07:45:25 UTC 
(rev 4452)
+++ code/gazebo/trunk/server/rendering/OgreCreator.cc   2008-03-28 09:31:36 UTC 
(rev 4453)
@@ -289,7 +289,7 @@
       }
       catch (int)
       {
-        gzmsg(0) << "Unable to set sky dome to material[" << material << "]\n";
+        gzmsg(0, "Unable to set sky dome to material[" << material << "]");
       }
 
     }

Modified: code/gazebo/trunk/server/rendering/OgreVisual.cc
===================================================================
--- code/gazebo/trunk/server/rendering/OgreVisual.cc    2008-03-28 07:45:25 UTC 
(rev 4452)
+++ code/gazebo/trunk/server/rendering/OgreVisual.cc    2008-03-28 09:31:36 UTC 
(rev 4453)
@@ -194,15 +194,15 @@
   }
   catch (Ogre::Exception e)
   {
-    gzmsg(0) << "Unable to get Material[" << materialName << "] for Geometry["
-    << this->sceneNode->getName() << ". Object will appear white.\n";
+    gzmsg(0, "Unable to get Material[" << materialName << "] for Geometry[" 
+    << this->sceneNode->getName() << ". Object will appear white.");
     return;
   }
 
   if (this->origMaterial.isNull())
   {
-    gzmsg(0) << "Unable to get Material[" << materialName << "] for Geometry["
-    << this->sceneNode->getName() << ". Object will appear white\n";
+    gzmsg(0, "Unable to get Material[" << materialName << "] for Geometry["
+    << this->sceneNode->getName() << ". Object will appear white");
     return;
   }
 
@@ -243,8 +243,8 @@
   }
   catch (Ogre::Exception e)
   {
-    gzmsg(0) << "Unable to set Material[" << myMaterialName << "] to Geometry["
-    << this->sceneNode->getName() << ". Object will appear white.\n";
+    gzmsg(0, "Unable to set Material[" << myMaterialName << "] to Geometry["
+    << this->sceneNode->getName() << ". Object will appear white.");
   }
 }
 
@@ -260,7 +260,7 @@
 
   if (this->myMaterial.isNull())
   {
-    gzmsg(0) << "The visual " << this->sceneNode->getName() << " can't set 
transparency for this geom without a material\n";
+    gzmsg(0, "The visual " << this->sceneNode->getName() << " can't set 
transparency for this geom without a material");
     return;
   }
 

Modified: code/gazebo/trunk/server/sensors/Sensor.cc
===================================================================
--- code/gazebo/trunk/server/sensors/Sensor.cc  2008-03-28 07:45:25 UTC (rev 
4452)
+++ code/gazebo/trunk/server/sensors/Sensor.cc  2008-03-28 09:31:36 UTC (rev 
4453)
@@ -91,7 +91,7 @@
 {
   if (!node)
   {
-    gzmsg(0) << this->GetName() << " sensor has no controller.\n";
+    gzmsg(0, this->GetName() << " sensor has no controller.");
     return;
   }
 

Modified: code/gazebo/trunk/server/sensors/camera/MonoCameraSensor.cc
===================================================================
--- code/gazebo/trunk/server/sensors/camera/MonoCameraSensor.cc 2008-03-28 
07:45:25 UTC (rev 4452)
+++ code/gazebo/trunk/server/sensors/camera/MonoCameraSensor.cc 2008-03-28 
09:31:36 UTC (rev 4453)
@@ -133,7 +133,7 @@
 const unsigned char *MonoCameraSensor::GetImageData(unsigned int i)
 {
   if (i!=0)
-    gzerr(0) << "Camera index must be zero for mono cam";
+    gzmsg(0, "Camera index must be zero for mono cam");
 
   Ogre::HardwarePixelBufferSharedPtr mBuffer;
   size_t size;

Modified: code/gazebo/trunk/server/sensors/camera/StereoCameraSensor.cc
===================================================================
--- code/gazebo/trunk/server/sensors/camera/StereoCameraSensor.cc       
2008-03-28 07:45:25 UTC (rev 4452)
+++ code/gazebo/trunk/server/sensors/camera/StereoCameraSensor.cc       
2008-03-28 09:31:36 UTC (rev 4453)
@@ -172,7 +172,7 @@
 
   if (i > 1)
   {
-    gzerr(0) << "Camera index must be 0=Left or 1=Right for stereo camera\n";
+    gzmsg(0, "Camera index must be 0=Left or 1=Right for stereo camera");
     i = 1;
   }
 


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to