CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/DQM/TrackerCommon/src/MessageDispatcher.cc

Go to the documentation of this file.
00001 #include "DQM/TrackerCommon/interface/MessageDispatcher.h"
00002 #include <iostream>
00003 
00004 std::string Message::getType() 
00005 { 
00006   if (type == info) { return "INFO"; } 
00007   else if (type == warning) { return "WARNING"; } 
00008   else { return "ERROR"; } 
00009 }
00010 
00011 void MessageDispatcher::dispatchMessages(xgi::Output *out)
00012 {
00013   out->getHTTPResponseHeader().addHeader("Content-Type", "text/xml");
00014   
00015   *out << "<?xml version=\"1.0\" ?>" << std::endl;
00016    
00017   *out << "<Messages>" << std::endl;
00018   
00019   int i = 1;
00020   std::vector<Message *>::iterator it;
00021   for (it = undispatched.begin(); it != undispatched.end(); it++)
00022     {
00023       *out << "<Message"  << i << ">" << std::endl;
00024       
00025       *out << "<Type>"  << (*it)->getType()  << "</Type>"  << std::endl;
00026       *out << "<Title>" << (*it)->getTitle() << "</Title>" << std::endl;
00027       *out << "<Text>"  << (*it)->getText()  << "</Text>"  << std::endl;
00028       
00029       *out << "</Message" << i << ">" << std::endl;
00030 
00031       i++;
00032     }
00033   
00034   *out << "</Messages>" << std::endl;
00035 
00036   undispatched.clear();
00037 }