CMS 3D CMS Logo

Public Member Functions | Private Attributes

MessageDispatcher Class Reference

#include <MessageDispatcher.h>

List of all members.

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.

    {
    }

Member Function Documentation

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()); 
    }

Member Data Documentation

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

Definition at line 43 of file MessageDispatcher.h.

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