Open Lighting Architecture 0.10.9
Loading...
Searching...
No Matches
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
29namespace ola {
30namespace 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
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
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
125
133 virtual const TimeStamp *WakeUpTime() const = 0;
134};
135} // namespace io
136} // namespace ola
137#endif // INCLUDE_OLA_IO_SELECTSERVERINTERFACE_H_
A 0 argument callback which can be called multiple times.
Definition Callback.h:129
A 0 argument callback which deletes itself after it's run.
Definition Callback.h:141
Definition Clock.h:126
Definition Clock.h:179
A BidirectionalFileDescriptor that also generates notifications when closed.
Definition Descriptor.h:283
Represents a file descriptor that supports reading data.
Definition Descriptor.h:140
The interface for the SelectServer.
Definition SelectServerInterface.h:42
virtual ola::thread::timeout_id RegisterSingleTimeout(const ola::TimeInterval &interval, SingleUseCallback0< void > *closure)=0
Execute a callback after a certain time interval.
virtual ola::thread::timeout_id RegisterSingleTimeout(unsigned int ms, SingleUseCallback0< void > *closure)=0
Execute a callback after a certain time interval.
virtual bool AddReadDescriptor(class ReadFileDescriptor *descriptor)=0
Register a ReadFileDescriptor for read-events.
virtual const TimeStamp * WakeUpTime() const =0
The time when this SelectServer was woken up.
virtual ola::thread::timeout_id RegisterRepeatingTimeout(const ola::TimeInterval &interval, ola::Callback0< bool > *closure)=0
Execute a callback periodically.
virtual void RemoveTimeout(ola::thread::timeout_id id)=0
Cancel an existing timeout.
virtual void RemoveWriteDescriptor(class WriteFileDescriptor *descriptor)=0
Remove a WriteFileDescriptor for write-events.
virtual void RemoveReadDescriptor(class ReadFileDescriptor *descriptor)=0
Remove a ReadFileDescriptor for read-events.
virtual ola::thread::timeout_id RegisterRepeatingTimeout(unsigned int ms, Callback0< bool > *closure)=0
Execute a callback periodically.
virtual bool AddReadDescriptor(class ConnectedDescriptor *descriptor, bool delete_on_close=false)=0
Register a ConnectedDescriptor for read-events.
virtual bool AddWriteDescriptor(class WriteFileDescriptor *descriptor)=0
Register a WriteFileDescriptor for write-events.
virtual void RemoveReadDescriptor(class ConnectedDescriptor *descriptor)=0
Remove a ConnectedDescriptor for read-events.
Represents a file descriptor that supports writing data.
Definition Descriptor.h:170
Combines the ExecutorInterface and the SchedulerInterface.
Definition SchedulingExecutorInterface.h:34
void * timeout_id
A timeout handle which can later be used to cancel a timeout.
Definition SchedulerInterface.h:34
The namespace containing all OLA symbols.
Definition Credentials.cpp:44