CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/DQM/TrackerCommon/interface/MessageDispatcher.h

Go to the documentation of this file.
00001 #ifndef _DQM_TrackerCommon_MessageDispatcher_h_
00002 #define _DQM_TrackerCommon_MessageDispatcher_h_
00003 
00004 #include <vector>
00005 #include <string>
00006 
00007 #include "xgi/Utils.h"
00008 #include "xgi/Method.h"
00009 
00010 
00011 enum MessageType { info = 0, warning = 1, error = 2 };
00012 
00013 
00014 class Message
00015 {
00016 
00017  private:
00018 
00019   std::string title;
00020   std::string text;
00021   MessageType type;
00022 
00023  public:
00024 
00025   Message(std::string the_title, std::string the_text, MessageType the_type)
00026     {
00027       type = the_type;
00028       title = the_title;
00029       text = the_text;
00030     }
00031 
00032   std::string getTitle() { return title; }
00033   std::string getText() { return text; }
00034   std::string getType();
00035 };
00036 
00037 
00038 class MessageDispatcher
00039 {
00040 
00041  private:
00042 
00043   std::vector<Message *> undispatched;
00044 
00045  public:
00046 
00047   MessageDispatcher()
00048     {
00049     }
00050 
00051   void add(Message *new_message)
00052     {
00053       undispatched.push_back(new_message);
00054     }
00055 
00056   bool hasAnyMessages()
00057     { 
00058       return (!undispatched.empty()); 
00059     }
00060 
00061   void dispatchMessages(xgi::Output *out);
00062 
00063 };
00064 
00065 #endif