CMS 3D CMS Logo

IOSelector.h

Go to the documentation of this file.
00001 #ifndef CLASSLIB_IO_SELECTOR_H
00002 # define CLASSLIB_IO_SELECTOR_H
00003 
00004 //<<<<<< INCLUDES                                                       >>>>>>
00005 
00006 # include "classlib/sysapi/IOTypes.h"
00007 # include "classlib/iobase/IOSelectCB.h"
00008 # include <vector>
00009 
00010 namespace lat {
00011 //<<<<<< PUBLIC DEFINES                                                 >>>>>>
00012 //<<<<<< PUBLIC CONSTANTS                                               >>>>>>
00013 //<<<<<< PUBLIC TYPES                                                   >>>>>>
00014 
00015 class IOChannel;
00016 class IOSelectMethod;
00017 
00018 //<<<<<< PUBLIC VARIABLES                                               >>>>>>
00019 //<<<<<< PUBLIC FUNCTIONS                                               >>>>>>
00020 //<<<<<< CLASS DECLARATIONS                                             >>>>>>
00021 
00109 class IOSelector
00110 {
00111 public:
00113     enum Strategy {
00120         S_DEFAULT,
00121 
00123         S_SELECT,
00124 
00128         S_RTSIGIO,
00129 
00132         S_RTSIGONE,
00133 
00135         S_DEVPOLL,
00136 
00138         S_POLL,
00139 
00141         S_KQUEUE
00142     };
00143 
00145     CLASSLIB_API static const Strategy SV_DEFAULT [];
00146 
00148     CLASSLIB_API static const Strategy SV_HIGHPERF [];
00149 
00150     IOSelector (const Strategy *strategy = SV_DEFAULT);
00151     virtual ~IOSelector (void);
00152 
00153     // virtual void     init (void);
00154     // virtual void     setOption (int option, int value);
00156     // virtual void     shutdown (void);
00157 
00158     // Attaching and detaching channels
00159     virtual void        attach (IOChannel *channel, unsigned mask,
00160                                 IOSelectCB c = IOSelectCB());
00161     virtual void        detach (IOChannel *channel);
00162     // virtual void     detach (unsigned index);
00163     virtual void        clear (void);
00164 
00165     // Channel status access
00166     // virtual unsigned channels    (void) const;
00167 
00168     // virtual IOChannel *      channel     (unsigned index) const;
00169     // virtual unsigned mask        (unsigned index) const;
00170     virtual void        setMask     (IOChannel *channel, unsigned value);
00171     virtual void        andMask     (IOChannel *channel, unsigned value);
00172     virtual void        orMask      (IOChannel *channel, unsigned value);
00173 
00174     // virtual unsigned status      (unsigned index) const;
00175     // virtual void     clearStatus (unsigned index, unsigned valueMask);
00176     // virtual bool     canAccept   (unsigned index) const;
00177     // virtual bool     canConnect  (unsigned index) const;
00178     // virtual bool     canRead     (unsigned index) const;
00179     // virtual bool     canWrite    (unsigned index) const;
00180     // virtual bool     canUrgent   (unsigned index) const;
00181 
00182     // Selection
00183     virtual unsigned    dispatch    (long msecs = -1);
00184     virtual unsigned    pump        (long msecs = -1);
00185     virtual bool        wait        (long msecs = -1);
00186     virtual bool        nextReady   (IOSelectEvent &event, IOSelectCB &c);
00187     //< NB: No guarantees as to the order in which clients are processed!
00188 
00189     // virtual void     initWakeUpPipe (void);
00190     // virtual int      wakeUp (void);
00191 
00192 private:
00193 #if 0
00194     virtual unsigned    clients   (void) const = 0;
00195     virtual IOFD        fd        (unsigned index) const = 0;
00196     virtual unsigned    mask      (unsigned index) const = 0;
00197     virtual void        setMask   (unsigned index, unsigned value) = 0;
00198     virtual void        andMask   (unsigned index, unsigned value);
00199     virtual void        orMask    (unsigned index, unsigned value);
00200     virtual unsigned    status    (unsigned index) const = 0;
00201     virtual void        setStatus (unsigned index, unsigned value) = 0;
00202 #endif
00203 
00204     IOSelectMethod      *m_strategy;
00205     // Pipe             *m_wakeUpPipe;
00206 };
00207 
00208 //<<<<<< INLINE PUBLIC FUNCTIONS                                        >>>>>>
00209 //<<<<<< INLINE MEMBER FUNCTIONS                                        >>>>>>
00210 
00211 } // namespace lat
00212 #endif // CLASSLIB_IO_SELECTOR_H

Generated on Tue Jun 9 17:38:52 2009 for CMSSW by  doxygen 1.5.4