ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/iom.h
(Generate patch)

Comparing rxvt-unicode/src/iom.h (file contents):
Revision 1.6 by pcg, Fri Jan 16 22:11:09 2004 UTC vs.
Revision 1.7 by pcg, Sat Jan 17 01:20:01 2004 UTC

1/* 1/*
2 iom.h -- generic I/O multiplexor 2 iom.h -- generic I/O multiplexor
3 Copyright (C) 2003 Marc Lehmann <pcg@goof.com> 3 Copyright (C) 2003, 2004 Marc Lehmann <pcg@goof.com>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18*/ 18*/
19 19
20#ifndef VPE_IOM_H__ 20#ifndef IOM_H__
21#define VPE_IOM_H__ 21#define IOM_H__
22 22
23#include <cassert> 23// required:
24// - a vector template like simplevec or stl's vector
25// - defines for all watcher types required in your app
26// edit iom_conf.h as appropriate.
27#include "iom_conf.h"
24 28
25#include "callback.h" 29#include "callback.h"
26#include "rxvtvec.h"
27 30
28#ifndef IOM_IO 31#ifndef IOM_IO
29# define IOM_IO 1 32# define IOM_IO 0
30#endif 33#endif
31#ifndef IOM_TIME 34#ifndef IOM_TIME
32# define IOM_TIME 1 35# define IOM_TIME 0
33#endif 36#endif
34#ifndef IOM_CHECK 37#ifndef IOM_CHECK
35# define IOM_CHECK 1 38# define IOM_CHECK 0
36#endif 39#endif
37#ifndef IOM_IDLE 40#ifndef IOM_IDLE
38# define IOM_IDLE 0 41# define IOM_IDLE 0
39#endif 42#endif
40 43
41typedef double tstamp; 44typedef double tstamp;
42extern tstamp NOW; 45extern tstamp NOW;
43 46
47struct watcher;
44#if IOM_IO 48#if IOM_IO
45 struct io_watcher; 49struct io_watcher;
46#endif 50#endif
47#if IOM_TIME 51#if IOM_TIME
48 struct time_watcher; 52struct time_watcher;
49#endif 53#endif
50#if IOM_CHECK 54#if IOM_CHECK
51 struct check_watcher; 55struct check_watcher;
52#endif 56#endif
53#if IOM_IDLE 57#if IOM_IDLE
54 struct idle_watcher; 58struct idle_watcher;
55#endif 59#endif
56 60
57template<class watcher> 61template<class watcher>
58struct io_manager_vec : protected simplevec<watcher *> { 62struct io_manager_vec : protected vector<watcher *> {
59 friend class io_manager; 63 friend class io_manager;
60protected: 64protected:
61 void erase_unordered (unsigned int pos) 65 void erase_unordered (unsigned int pos)
62 { 66 {
63 watcher *w = (*this)[size () - 1]; 67 watcher *w = (*this)[size () - 1];
82#if IOM_IDLE 86#if IOM_IDLE
83 io_manager_vec<idle_watcher> iw; 87 io_manager_vec<idle_watcher> iw;
84#endif 88#endif
85 89
86 template<class watcher> 90 template<class watcher>
87 void reg (watcher *w, simplevec<watcher *> &queue); 91 void reg (watcher *w, io_manager_vec<watcher> &queue);
88 92
89 template<class watcher> 93 template<class watcher>
90 void unreg (watcher *w, simplevec<watcher *> &queue); 94 void unreg (watcher *w, io_manager_vec<watcher> &queue);
91 95
92public: 96public:
93 // register a watcher 97 // register a watcher
94#if IOM_IO 98#if IOM_IO
95 void reg (io_watcher *w); void unreg (io_watcher *w); 99 void reg (io_watcher *w); void unreg (io_watcher *w);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines