ircproxy The Ultimate Cyborg |
#include <Matcher.h>
Definition at line 398 of file Matcher.h.
Public Member Functions | |
void | destroy_requests (void) |
Destroy all remaining event requests in the queue. | |
bool | trigger (MatcherEventRequestBase::event_type_ct const &event_type) |
Trigger the event. Returns true if the event should not be handled any further. | |
Protected Member Functions | |
void | add_request (MatcherEventRequestBase *request) |
Add an event request to the queue. | |
~MatcherEventRequestQueue () | |
Destructor. | |
Private Types | |
typedef std::deque < MatcherEventRequestBase * > | event_requests_ct |
Event request queue type. | |
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 queued event requests. | |
event_requests_ct | M_event_requests_tmp |
Temporary event request queue for when M_event_requests is locked. |
typedef std::deque<MatcherEventRequestBase*> MatcherEventRequestQueue::event_requests_ct [private] |
MatcherEventRequestQueue::~MatcherEventRequestQueue | ( | ) | [inline, protected] |
void MatcherEventRequestQueue::add_request | ( | MatcherEventRequestBase * | request | ) | [inline, protected] |
Add an event request to the queue.
Definition at line 406 of file Matcher.h.
Referenced by trigger().
00407 { 00408 if (M_event_requests_locked) 00409 M_event_requests_tmp.push_back(request); 00410 else 00411 M_event_requests.push_back(request); 00412 }
void MatcherEventRequestQueue::destroy_requests | ( | void | ) |
Destroy all remaining event requests in the queue.
Definition at line 109 of file Matcher.cc.
References ASSERT, M_event_requests, and M_event_requests_locked.
00110 { 00111 ASSERT(!M_event_requests_locked); 00112 while (!M_event_requests.empty()) 00113 { 00114 M_event_requests.front()->release(); 00115 M_event_requests.pop_front(); 00116 } 00117 }
bool MatcherEventRequestQueue::trigger | ( | MatcherEventRequestBase::event_type_ct const & | event_type | ) |
Trigger the event. Returns true if the event should not be handled any further.
Definition at line 119 of file Matcher.cc.
References add_request(), ASSERT, DoutEntering, M_event_requests, M_event_requests_locked, M_event_requests_tmp, and debug::channels::dc::matcher.
00120 { 00121 #if 0 // Too verbose. 00122 DoutEntering(dc::matcher, "MatcherEventRequestQueue::trigger(" << 00123 libcwd::type_info_of<MatcherEventRequestBase::event_type_ct>().demangled_name() << 00124 " const& " << event_type << ")"); 00125 #endif 00126 bool sink = false; 00127 { 00128 ASSERT(M_event_requests_locked > 0 || M_event_requests_tmp.empty()); 00129 Increment tmp(M_event_requests_locked); 00130 event_requests_ct::iterator iter = M_event_requests.begin(); 00131 while (iter != M_event_requests.end()) 00132 { 00133 if ((*iter)->canceled()) 00134 { 00135 Dout(dc::matcher, "Removing canceled " << **iter); 00136 (*iter)->release(); 00137 iter = M_event_requests.erase(iter); 00138 } 00139 else if ((*iter)->request_data().is_match(event_type.message())) 00140 { 00141 Dout(dc::matcher, "Calling handle() for " << **iter); 00142 (*iter)->handle(event_type); 00143 sink = (*iter)->request_data().sink(); 00144 (*iter)->release(); 00145 iter = M_event_requests.erase(iter); 00146 } 00147 else 00148 ++iter; 00149 } 00150 } 00151 if (M_event_requests_locked == 0) 00152 while (!M_event_requests_tmp.empty()) 00153 { 00154 add_request(M_event_requests_tmp.front()); 00155 M_event_requests_tmp.pop_front(); 00156 } 00157 return sink; 00158 }
Non-zero if M_event_requests is being processed in a loop.
Definition at line 401 of file Matcher.h.
Referenced by destroy_requests(), and trigger().
The queued event requests.
Definition at line 402 of file Matcher.h.
Referenced by destroy_requests(), and trigger().
Copyright © 2005-2007 Carlo Wood. All rights reserved. |
---|