Open Lighting Architecture: common/io/PollerInterface.h Source File

| Open Lighting Architecture 0.10.9

Loading...
Searching...
No Matches
PollerInterface.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 * PollerInterface.h
17 * A poller provides the select loop.
18 * Copyright (C) 2013 Simon Newton
19 */
20
21#ifndef COMMON_IO_POLLERINTERFACE_H_
22#define COMMON_IO_POLLERINTERFACE_H_
23
24#include <ola/Clock.h>
25#include <ola/io/Descriptor.h>
26
27#include "common/io/TimeoutManager.h"
28
29namespace ola {
30namespace io {
31
70 class PollerInterface {
71 public :
75 virtual ~PollerInterface() {}
76
83 virtual bool AddReadDescriptor(ReadFileDescriptor *descriptor) = 0;
84
94 virtual bool AddReadDescriptor(ConnectedDescriptor *descriptor,
95 bool delete_on_close) = 0;
96
104 virtual bool RemoveReadDescriptor(ReadFileDescriptor *descriptor) = 0;
105
113 virtual bool RemoveReadDescriptor(ConnectedDescriptor *descriptor) = 0;
114
121 virtual bool AddWriteDescriptor(WriteFileDescriptor *descriptor) = 0;
122
130 virtual bool RemoveWriteDescriptor(WriteFileDescriptor *descriptor) = 0;
131
132 virtual const TimeStamp *WakeUpTime() const = 0;
133
140 virtual bool Poll(TimeoutManager *timeout_manager,
141 const TimeInterval &poll_interval) = 0;
142
143 static const char K_READ_DESCRIPTOR_VAR[];
144 static const char K_WRITE_DESCRIPTOR_VAR[];
145 static const char K_CONNECTED_DESCRIPTORS_VAR[];
146
147 protected:
148 static const char K_LOOP_TIME[];
149 static const char K_LOOP_COUNT[];
150};
151} // namespace io
152} // namespace ola
153#endif // COMMON_IO_POLLERINTERFACE_H_
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::PollerInterface
The interface for the Poller classes.
Definition PollerInterface.h:70
ola::io::PollerInterface::K_READ_DESCRIPTOR_VAR
static const char K_READ_DESCRIPTOR_VAR[]
The number of descriptors registered for read events.
Definition PollerInterface.h:143
ola::io::PollerInterface::K_CONNECTED_DESCRIPTORS_VAR
static const char K_CONNECTED_DESCRIPTORS_VAR[]
The number of connected descriptors registered for read events.
Definition PollerInterface.h:145
ola::io::PollerInterface::RemoveWriteDescriptor
virtual bool RemoveWriteDescriptor(WriteFileDescriptor *descriptor)=0
Unregister a WriteFileDescriptor for write events.
ola::io::PollerInterface::AddWriteDescriptor
virtual bool AddWriteDescriptor(WriteFileDescriptor *descriptor)=0
Register a WriteFileDescriptor to receive ready-to-write events.
ola::io::PollerInterface::RemoveReadDescriptor
virtual bool RemoveReadDescriptor(ReadFileDescriptor *descriptor)=0
Unregister a ReadFileDescriptor for read events.
ola::io::PollerInterface::AddReadDescriptor
virtual bool AddReadDescriptor(ReadFileDescriptor *descriptor)=0
Register a ReadFileDescriptor for read events.
ola::io::PollerInterface::AddReadDescriptor
virtual bool AddReadDescriptor(ConnectedDescriptor *descriptor, bool delete_on_close)=0
Register a ConnectedDescriptor for read events.
ola::io::PollerInterface::~PollerInterface
virtual ~PollerInterface()
Destructor.
Definition PollerInterface.h:75
ola::io::PollerInterface::K_LOOP_COUNT
static const char K_LOOP_COUNT[]
The number of iterations through the event loop.
Definition PollerInterface.h:149
ola::io::PollerInterface::K_WRITE_DESCRIPTOR_VAR
static const char K_WRITE_DESCRIPTOR_VAR[]
The number of descriptors registered for write events.
Definition PollerInterface.h:144
ola::io::PollerInterface::Poll
virtual bool Poll(TimeoutManager *timeout_manager, const TimeInterval &poll_interval)=0
Poll the Descriptors for events and execute any callbacks.
ola::io::PollerInterface::K_LOOP_TIME
static const char K_LOOP_TIME[]
The time spent in the event loop.
Definition PollerInterface.h:148
ola::io::PollerInterface::RemoveReadDescriptor
virtual bool RemoveReadDescriptor(ConnectedDescriptor *descriptor)=0
Unregister a ConnectedDescriptor for read events.
ola::io::ReadFileDescriptor
Represents a file descriptor that supports reading data.
Definition Descriptor.h:140
ola::io::TimeoutManager
Manages timer events.
Definition TimeoutManager.h:45
ola::io::WriteFileDescriptor
Represents a file descriptor that supports writing data.
Definition Descriptor.h:170
Descriptor.h
ola::io
Classes for general I/O and event handling.
Definition Descriptor.cpp:49
ola
The namespace containing all OLA symbols.
Definition Credentials.cpp:44