1/* 2 * Copyright (c) 2000-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 135 unchanged lines hidden (view full) --- 144 protected: 145 /// Accessor for flags. 146 Flags 147 getFlags() const 148 { 149 return flags & PublicRead; 150 } 151 |
152 bool 153 isFlagSet(Flags _flags) const |
154 { 155 assert(_flags.noneSet(~PublicRead)); 156 return flags.isSet(_flags); 157 } 158 |
159 /// Accessor for flags. 160 void 161 setFlags(Flags _flags) 162 { 163 assert(_flags.noneSet(~PublicWrite)); 164 flags.set(_flags); 165 } 166 --- 68 unchanged lines hidden (view full) --- 235 236 /// Maximum priority 237 static const Priority Maximum_Pri = SCHAR_MAX; 238 239 /* 240 * Event constructor 241 * @param queue that the event gets scheduled on 242 */ |
243 Event(Priority p = Default_Pri, Flags f = 0) 244 : nextBin(NULL), nextInBin(NULL), _priority(p), 245 flags(Initialized | f) |
246 { |
247 assert(f.noneSet(~PublicWrite)); |
248#ifndef NDEBUG 249 instance = ++instanceCounter; 250 queue = NULL; 251#endif 252#ifdef EVENTQ_DEBUG 253 whenCreated = curTick(); 254 whenScheduled = 0; 255#endif --- 140 unchanged lines hidden (view full) --- 396 * @todo this assert is a good bug catcher. I need to 397 * make it true again. 398 */ 399 //assert(head->when() >= when && "event scheduled in the past"); 400 serviceOne(); 401 } 402 } 403 |
404 // return true if no events are queued 405 bool empty() const { return head == NULL; } 406 407 void dump() const; 408 |
409 bool debugVerify() const; 410 411#ifndef SWIG 412 virtual void serialize(std::ostream &os); 413 virtual void unserialize(Checkpoint *cp, const std::string §ion); 414#endif 415}; 416 --- 127 unchanged lines hidden (view full) --- 544{ 545 class DelayEvent : public Event 546 { 547 private: 548 T *object; 549 550 public: 551 DelayEvent(T *o) |
552 : Event(Default_Pri, AutoDelete), object(o) 553 { } |
554 void process() { (object->*F)(); } 555 const char *description() const { return "delay"; } 556 }; 557 558 eventq->schedule(new DelayEvent(object), when); 559} 560 561template <class T, void (T::* F)()> --- 33 unchanged lines hidden --- |