Open Lighting Architecture  0.9.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SelectServerInterface.h
1 /*
2  * This library is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU Lesser General Public
4  * License as published by the Free Software Foundation; either
5  * version 2.1 of the License, or (at your option) any later version.
6  *
7  * This library is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10  * Lesser General Public License for more details.
11  *
12  * You should have received a copy of the GNU Lesser General Public
13  * License along with this library; if not, write to the Free Software
14  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15  *
16  * SelectServerInterface.h
17  * An interface to a SelectServer that enforces clean separation.
18  * Copyright (C) 2010 Simon Newton
19  */
20 
21 #ifndef INCLUDE_OLA_IO_SELECTSERVERINTERFACE_H_
22 #define INCLUDE_OLA_IO_SELECTSERVERINTERFACE_H_
23 
24 #include <ola/Callback.h>
25 #include <ola/Clock.h>
26 #include <ola/io/Descriptor.h>
27 #include <ola/thread/SchedulingExecutorInterface.h>
28 
29 namespace ola {
30 namespace io {
31 
43  public :
45  virtual ~SelectServerInterface() {}
46 
55  virtual bool AddReadDescriptor(class ReadFileDescriptor *descriptor) = 0;
56 
69  virtual bool AddReadDescriptor(class ConnectedDescriptor *descriptor,
70  bool delete_on_close = false) = 0;
71 
79  virtual void RemoveReadDescriptor(
80  class ReadFileDescriptor *descriptor) = 0;
81 
89  virtual void RemoveReadDescriptor(class ConnectedDescriptor *descriptor) = 0;
90 
97  virtual bool AddWriteDescriptor(
98  class WriteFileDescriptor *descriptor) = 0;
99 
107  virtual void RemoveWriteDescriptor(
108  class WriteFileDescriptor *descriptor) = 0;
109 
111  unsigned int ms,
112  Callback0<bool> *closure) = 0;
114  const ola::TimeInterval &interval,
115  ola::Callback0<bool> *closure) = 0;
116 
118  unsigned int ms,
119  SingleUseCallback0<void> *closure) = 0;
121  const ola::TimeInterval &interval,
122  SingleUseCallback0<void> *closure) = 0;
123 
124  virtual void RemoveTimeout(ola::thread::timeout_id id) = 0;
125 
133  virtual const TimeStamp *WakeUpTime() const = 0;
134 };
135 } // namespace io
136 } // namespace ola
137 #endif // INCLUDE_OLA_IO_SELECTSERVERINTERFACE_H_