Open Lighting Architecture: include/ola/io/SelectServerInterface.h Source File

| 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
42 class SelectServerInterface: public ola::thread::SchedulingExecutorInterface {
43 public :
44 SelectServerInterface() {}
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
110 virtual ola::thread::timeout_id RegisterRepeatingTimeout(
111 unsigned int ms,
112 Callback0<bool> *closure) = 0;
113 virtual ola::thread::timeout_id RegisterRepeatingTimeout(
114 const ola::TimeInterval &interval,
115 ola::Callback0<bool> *closure) = 0;
116
117 virtual ola::thread::timeout_id RegisterSingleTimeout(
118 unsigned int ms,
119 SingleUseCallback0<void> *closure) = 0;
120 virtual ola::thread::timeout_id RegisterSingleTimeout(
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_
Callback.h
ola::Callback0
A 0 argument callback which can be called multiple times.
Definition Callback.h:129
ola::SingleUseCallback0
A 0 argument callback which deletes itself after it's run.
Definition Callback.h:141
ola::TimeInterval
Definition Clock.h:126
ola::TimeStamp
Definition Clock.h:179
ola::io::ConnectedDescriptor
A BidirectionalFileDescriptor that also generates notifications when closed.
Definition Descriptor.h:283
ola::io::ReadFileDescriptor
Represents a file descriptor that supports reading data.
Definition Descriptor.h:140
ola::io::SelectServerInterface::RegisterSingleTimeout
virtual ola::thread::timeout_id RegisterSingleTimeout(const ola::TimeInterval &interval, SingleUseCallback0< void > *closure)=0
Execute a callback after a certain time interval.
ola::io::SelectServerInterface::RegisterSingleTimeout
virtual ola::thread::timeout_id RegisterSingleTimeout(unsigned int ms, SingleUseCallback0< void > *closure)=0
Execute a callback after a certain time interval.
ola::io::SelectServerInterface::AddReadDescriptor
virtual bool AddReadDescriptor(class ReadFileDescriptor *descriptor)=0
Register a ReadFileDescriptor for read-events.
ola::io::SelectServerInterface::WakeUpTime
virtual const TimeStamp * WakeUpTime() const =0
The time when this SelectServer was woken up.
ola::io::SelectServerInterface::RegisterRepeatingTimeout
virtual ola::thread::timeout_id RegisterRepeatingTimeout(const ola::TimeInterval &interval, ola::Callback0< bool > *closure)=0
Execute a callback periodically.
ola::io::SelectServerInterface::RemoveTimeout
virtual void RemoveTimeout(ola::thread::timeout_id id)=0
Cancel an existing timeout.
ola::io::SelectServerInterface::RemoveWriteDescriptor
virtual void RemoveWriteDescriptor(class WriteFileDescriptor *descriptor)=0
Remove a WriteFileDescriptor for write-events.
ola::io::SelectServerInterface::RemoveReadDescriptor
virtual void RemoveReadDescriptor(class ReadFileDescriptor *descriptor)=0
Remove a ReadFileDescriptor for read-events.
ola::io::SelectServerInterface::RegisterRepeatingTimeout
virtual ola::thread::timeout_id RegisterRepeatingTimeout(unsigned int ms, Callback0< bool > *closure)=0
Execute a callback periodically.
ola::io::SelectServerInterface::AddReadDescriptor
virtual bool AddReadDescriptor(class ConnectedDescriptor *descriptor, bool delete_on_close=false)=0
Register a ConnectedDescriptor for read-events.
ola::io::SelectServerInterface::AddWriteDescriptor
virtual bool AddWriteDescriptor(class WriteFileDescriptor *descriptor)=0
Register a WriteFileDescriptor for write-events.
ola::io::SelectServerInterface::RemoveReadDescriptor
virtual void RemoveReadDescriptor(class ConnectedDescriptor *descriptor)=0
Remove a ConnectedDescriptor for read-events.
ola::io::WriteFileDescriptor
Represents a file descriptor that supports writing data.
Definition Descriptor.h:170
ola::thread::SchedulingExecutorInterface
Combines the ExecutorInterface and the SchedulerInterface.
Definition SchedulingExecutorInterface.h:34
Descriptor.h
ola::io
Classes for general I/O and event handling.
Definition Descriptor.cpp:49
ola::thread::timeout_id
void * timeout_id
A timeout handle which can later be used to cancel a timeout.
Definition SchedulerInterface.h:34
ola
The namespace containing all OLA symbols.
Definition Credentials.cpp:44