Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

InterruptibleDispatcher.h

00001 #ifndef _UNEVT_InterruptibleDispatcher_H_  // -*-c++-*-
00002 
00003 #ifdef __GNUG__
00004 #  pragma interface
00005 #endif
00006 
00007 /* $Header: /home/hopper/src/cvs/C++/UniEvent/UniEvent/InterruptibleDispatcher.h,v 1.1 2002/03/08 22:42:54 hopper Exp $ */
00008 
00009 // For a log, see ../ChangeLog
00010 
00011 #define _UNEVT_InterruptibleDispatcher_H_
00012 
00013 namespace strmod {
00014 namespace unievent {
00015 
00016 class EventPtr;
00017 
00018 class InterruptibleDispatcher : virtual public Dispatcher {
00019  public:
00020    static const UNEVT_ClassIdent identifier;
00021 
00022    //! Because every class (even abstract ones) should have a constructor.
00023    InterruptibleDispatcher()                        { }
00024    //! Because abstract classes should have a virtual destructor.
00025    virtual ~InterruptibleDispatcher()               { }
00026 
00027    inline virtual int AreYouA(const ClassIdent &cid) const;
00028 
00029    /**
00030     * \brief This event is only triggered when interrupt() is called.
00031     *
00032     * When interrupt() is called, a flag is set so this event is put onto the
00033     * front of the queue as soon as the Dispatcher's event loop gets control
00034     * again.
00035     *
00036     * @param ev The event to fire when interrupt() is called.
00037     * @return <code>true</code> if the event was successfully set,
00038     * <code>false</code> if the event was not set because some other event was
00039     * already set.
00040     */
00041    virtual bool onInterrupt(const EventPtr &ev) = 0;
00042 
00043    /**
00044     * \brief Interrupts the dispatcher to execute a high priority event.
00045     *
00046     * This sets a flag so that as soon as the Dispatcher's event loop gets
00047     * control, the event set by onInterrupt() will be put on the front of the
00048     * queue.  It will also call the Event::interrupt() method of any
00049     * currently executing event.
00050     *
00051     * \note Implementations of this method should be safe to call from a thread
00052     * or a signal handling context.
00053     */
00054    virtual void interrupt() = 0;
00055 
00056  protected:
00057    virtual const ClassIdent *i_GetIdent() const        { return(&identifier); }
00058 
00059  private:
00060    //! Purposely left undefined.
00061    Dispatcher(const Dispatcher &b);
00062    //! Purposely left undefined.
00063    const Dispatcher &operator =(const Dispatcher &b);
00064 };
00065 
00066 #endif

Generated on Wed Jan 29 00:32:44 2003 for libNet by doxygen1.3-rc1