root/version_0/ext/files.h

Revision 372, 1.6 kB (checked in by blackhedd, 2 years ago)

epoll support for #defer (loop-breaker)

Line 
1 /*****************************************************************************
2
3 $Id: ed.h 243 2006-08-23 02:00:10Z blackhedd $
4
5 File:     files.h
6 Date:     26Aug06
7
8 Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved.
9 Gmail: blackhedd
10
11 This program is free software; you can redistribute it and/or modify
12 it under the terms of either: 1) the GNU General Public License
13 as published by the Free Software Foundation; either version 2 of the
14 License, or (at your option) any later version; or 2) Ruby's License.
15
16 See the file COPYING for complete licensing information.
17
18 *****************************************************************************/
19
20
21 #ifndef __FileStreamDescriptor__H_
22 #define __FileStreamDescriptor__H_
23
24
25
26 /**************************
27 class FileStreamDescriptor
28 **************************/
29
30 class FileStreamDescriptor: public EventableDescriptor
31 {
32         public:
33                 FileStreamDescriptor (int, EventMachine_t*);
34                 virtual ~FileStreamDescriptor();
35
36                 virtual void Read();
37                 virtual void Write();
38                 virtual void Heartbeat();
39
40                 virtual bool SelectForRead();
41                 virtual bool SelectForWrite();
42
43                 // Do we have any data to write? This is used by ShouldDelete.
44                 virtual int GetOutboundDataSize() {return OutboundDataSize;}
45
46         protected:
47                 struct OutboundPage {
48                         OutboundPage (const char *b, int l, int o=0): Buffer(b), Length(l), Offset(o) {}
49                         void Free() {if (Buffer) free ((char*)Buffer); }
50                         const char *Buffer;
51                         int Length;
52                         int Offset;
53                 };
54
55         protected:
56                 deque<OutboundPage> OutboundPages;
57                 int OutboundDataSize;
58
59         private:
60
61 };
62
63
64 #endif // __FileStreamDescriptor__H_
65
Note: See TracBrowser for help on using the browser.