CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
MessageDispatcher Class Reference

#include <MessageDispatcher.h>

Public Member Functions

void add (Message *new_message)
 
void dispatchMessages (xgi::Output *out)
 
bool hasAnyMessages ()
 
 MessageDispatcher ()
 

Private Attributes

std::vector< Message * > undispatched
 

Detailed Description

Definition at line 38 of file MessageDispatcher.h.

Constructor & Destructor Documentation

MessageDispatcher::MessageDispatcher ( )
inline

Definition at line 47 of file MessageDispatcher.h.

48  {
49  }

Member Function Documentation

void MessageDispatcher::add ( Message new_message)
inline

Definition at line 51 of file MessageDispatcher.h.

References undispatched.

Referenced by WebInterface::sendMessage().

52  {
53  undispatched.push_back(new_message);
54  }
std::vector< Message * > undispatched
void MessageDispatcher::dispatchMessages ( xgi::Output out)

Definition at line 11 of file MessageDispatcher.cc.

References i, and undispatched.

12 {
13  out->getHTTPResponseHeader().addHeader("Content-Type", "text/xml");
14 
15  *out << "<?xml version=\"1.0\" ?>" << std::endl;
16 
17  *out << "<Messages>" << std::endl;
18 
19  int i = 1;
20  std::vector<Message *>::iterator it;
21  for (it = undispatched.begin(); it != undispatched.end(); it++)
22  {
23  *out << "<Message" << i << ">" << std::endl;
24 
25  *out << "<Type>" << (*it)->getType() << "</Type>" << std::endl;
26  *out << "<Title>" << (*it)->getTitle() << "</Title>" << std::endl;
27  *out << "<Text>" << (*it)->getText() << "</Text>" << std::endl;
28 
29  *out << "</Message" << i << ">" << std::endl;
30 
31  i++;
32  }
33 
34  *out << "</Messages>" << std::endl;
35 
36  undispatched.clear();
37 }
std::vector< Message * > undispatched
int i
Definition: DBlmapReader.cc:9
tuple out
Definition: dbtoconf.py:99
bool MessageDispatcher::hasAnyMessages ( )
inline

Definition at line 56 of file MessageDispatcher.h.

References undispatched.

57  {
58  return (!undispatched.empty());
59  }
std::vector< Message * > undispatched

Member Data Documentation

std::vector<Message *> MessageDispatcher::undispatched
private

Definition at line 43 of file MessageDispatcher.h.

Referenced by add(), dispatchMessages(), and hasAnyMessages().