ircproxy  The Ultimate Cyborg

UserAnswerEventRequestQueue Class Reference

#include <UserAnswer.h>

List of all members.


Detailed Description

The UserAnswer event request queue class.

Definition at line 122 of file UserAnswer.h.


Public Member Functions

void destroy_requests (void)
 Destroy any requests for events left in the queue.
void trigger (UserAnswerEventRequestBase::event_type_ct const &event_type)
 Trigger an event.

Protected Member Functions

void add_request (UserAnswerEventRequestBase *request)
 Add event request request to the queue.
 ~UserAnswerEventRequestQueue ()
 Destructor.

Private Types

typedef std::deque
< UserAnswerEventRequestBase * > 
event_requests_ct
 The type of the event request queue.

Private Attributes

Counter M_event_requests_locked
 Non-zero if M_event_requests is being processed in a loop.
event_requests_ct M_event_requests
 The actual event request queue.
event_requests_ct M_event_requests_tmp
 Temporary event request queue for when M_event_requests is locked.

Member Typedef Documentation

The type of the event request queue.

Definition at line 124 of file UserAnswer.h.


Constructor & Destructor Documentation

UserAnswerEventRequestQueue::~UserAnswerEventRequestQueue (  )  [inline, protected]

Destructor.

Definition at line 139 of file UserAnswer.h.

References destroy_requests().

00139 { destroy_requests(); }


Member Function Documentation

void UserAnswerEventRequestQueue::add_request ( UserAnswerEventRequestBase request  )  [inline, protected]

Add event request request to the queue.

Definition at line 131 of file UserAnswer.h.

References M_event_requests, M_event_requests_locked, and M_event_requests_tmp.

Referenced by trigger().

00132       {
00133         if (M_event_requests_locked)
00134           M_event_requests_tmp.push_back(request);
00135         else
00136           M_event_requests.push_back(request);
00137       }

void UserAnswerEventRequestQueue::destroy_requests ( void   )  [inline]

Destroy any requests for events left in the queue.

Definition at line 142 of file UserAnswer.h.

References ASSERT, M_event_requests, and M_event_requests_locked.

Referenced by ~UserAnswerEventRequestQueue().

00143       {
00144         ASSERT(!M_event_requests_locked);
00145         while (!M_event_requests.empty())
00146         {
00147           M_event_requests.front()->release();
00148           M_event_requests.pop_front();
00149         }
00150       }

void UserAnswerEventRequestQueue::trigger ( UserAnswerEventRequestBase::event_type_ct const &  event_type  )  [inline]

Trigger an event.

Definition at line 152 of file UserAnswer.h.

References add_request(), DoutEntering, M_event_requests, M_event_requests_locked, and M_event_requests_tmp.

00153       {
00154         DoutEntering(dc::notice, "UserAnswerEventRequestQueue::trigger(" <<
00155             libcwd::type_info_of<UserAnswerEventRequestBase::event_type_ct>().demangled_name() <<
00156             " const& " << event_type << ")");
00157         {
00158           Increment tmp(M_event_requests_locked);
00159           event_requests_ct::iterator iter = M_event_requests.begin();
00160           while (iter != M_event_requests.end())
00161           {
00162             if ((*iter)->canceled())
00163             {
00164               Dout(dc::notice, "Removing canceled " << **iter);
00165               (*iter)->release();
00166               iter = M_event_requests.erase(iter);
00167             }
00168             else if (event_type.is_match((*iter)->target()))
00169             {
00170               Dout(dc::notice, "Calling handle() for " << **iter);
00171               (*iter)->handle(event_type);
00172               (*iter)->release();
00173               iter = M_event_requests.erase(iter);
00174             }
00175             else
00176               ++iter;
00177           }
00178         }
00179         if (M_event_requests_locked == 0)
00180           while (!M_event_requests_tmp.empty())
00181           {
00182             add_request(M_event_requests_tmp.front());
00183             M_event_requests_tmp.pop_front();
00184           }
00185       }


Member Data Documentation

Non-zero if M_event_requests is being processed in a loop.

Definition at line 126 of file UserAnswer.h.

Referenced by add_request(), destroy_requests(), and trigger().

The actual event request queue.

Definition at line 127 of file UserAnswer.h.

Referenced by add_request(), destroy_requests(), and trigger().

Temporary event request queue for when M_event_requests is locked.

Definition at line 128 of file UserAnswer.h.

Referenced by add_request(), and trigger().


The documentation for this class was generated from the following file:

Copyright © 2005-2007 Carlo Wood.  All rights reserved.