#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 |
Definition at line 38 of file MessageDispatcher.h.
MessageDispatcher::MessageDispatcher | ( | ) | [inline] |
Definition at line 47 of file MessageDispatcher.h.
{ }
void MessageDispatcher::add | ( | Message * | new_message | ) | [inline] |
Definition at line 51 of file MessageDispatcher.h.
References undispatched.
Referenced by WebInterface::sendMessage().
{ undispatched.push_back(new_message); }
void MessageDispatcher::dispatchMessages | ( | xgi::Output * | out | ) |
Definition at line 11 of file MessageDispatcher.cc.
References i, and undispatched.
{ out->getHTTPResponseHeader().addHeader("Content-Type", "text/xml"); *out << "<?xml version=\"1.0\" ?>" << std::endl; *out << "<Messages>" << std::endl; int i = 1; std::vector<Message *>::iterator it; for (it = undispatched.begin(); it != undispatched.end(); it++) { *out << "<Message" << i << ">" << std::endl; *out << "<Type>" << (*it)->getType() << "</Type>" << std::endl; *out << "<Title>" << (*it)->getTitle() << "</Title>" << std::endl; *out << "<Text>" << (*it)->getText() << "</Text>" << std::endl; *out << "</Message" << i << ">" << std::endl; i++; } *out << "</Messages>" << std::endl; undispatched.clear(); }
bool MessageDispatcher::hasAnyMessages | ( | ) | [inline] |
Definition at line 56 of file MessageDispatcher.h.
References undispatched.
{ return (!undispatched.empty()); }
std::vector<Message *> MessageDispatcher::undispatched [private] |
Definition at line 43 of file MessageDispatcher.h.
Referenced by add(), dispatchMessages(), and hasAnyMessages().