•OT_Classes/TNetworkEventHandler.h

//  TNetworkEventHandler.h - Macintosh OpenTransport network class object
// 
// Apple Macintosh Developer Technical Support
// Written by:  Vinne Moscaritolo
//
//  Copyright (work in progress)  Apple Computer, Inc All rights reserved.
//
// You may incorporate this sample code into your applications without
// restriction, though the sample code has been provided "AS IS" and the
// responsibility for its operation is 100% yours.  However, what you are
// not permitted to do is to redistribute the source as "DSC Sample Code"
// after having made changes. If you're going to re-distribute the source,
// we require that you make it clear in the source that the code was
// descended from Apple Sample Code, but that you've made changes.
// 
 
#ifndef _H_TNETWORKEVENTHANDLER
#define _H_TNETWORKEVENTHANDLER
 
#include <OpenTransport.h>
#include "TNetworkEvent.h"
#include "TNetworkException.h"
 
//
// TNetworkEventHandler  - OpenTransport Network Event Handler class 
//
class TNetworkEventHandler : private TLink
{
 
//  CONSTRUCTORS AND DESTRUCTORS
public:
            TNetworkEventHandler();
    virtual ~TNetworkEventHandler();
    
// HIGH LEVEL FUNCTIONS
public:
            void        ProcessEvents();
            TLifo*  GetEventQueue()  { return  &fEventQueue;  };
            
// ABSTRACT FUNCTIONS
    virtual void    HandleEvent(TNetworkEvent* ) = 0;
 
// CLASS FUNCTIONS
    static  void    ScanEventHandlerQueue();
 
// PROTECTED FIELDS
private:
    TLifo           fEventQueue;
 
// CLASS VARIABLES
private:
    static  TList   fgActiveList;
 
};
 
// USEFUL MACROS
 
#define QUEUE_NET_EVENT(_who_, _event_, _result_, _parm_) \
                _who_->GetEventQueue()->Enqueue( new  TNetworkEvent(_event_, _result_, _parm_))
 
#endif