Open Lighting Architecture  0.9.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Typedefs | Enumerations | Functions | Variables
ola::io Namespace Reference

Detailed Description

Classes for general I/O and event handling.

Classes

class  EPollData
class  EPoller
 An implementation of PollerInterface that uses epoll(). More...
class  KQueueData
class  KQueuePoller
 An implementation of PollerInterface that uses kevent / kqueue. More...
class  PollerInterface
 The interface for the Poller classes. More...
class  SelectPoller
 An implementation of PollerInterface that uses select(). More...
class  TimeoutManager
 Manages timer events. More...
class  WindowsPollerDescriptor
class  EventHolder
class  PollData
class  WindowsPoller
 An implementation of PollerInterface for Windows. More...
class  BigEndianInputStreamInterface
class  BigEndianInputStreamAdaptor
class  BigEndianInputStream
class  BigEndianOutputStreamInterface
class  BigEndianOutputStreamAdaptor
class  BigEndianOutputStream
class  ReadFileDescriptor
 Represents a file descriptor that supports reading data. More...
class  WriteFileDescriptor
 Represents a file descriptor that supports writing data. More...
class  BidirectionalFileDescriptor
 A file descriptor that supports both read & write. More...
class  UnmanagedFileDescriptor
 Allows a FD created by a library to be used with the SelectServer. More...
struct  UnmanagedFileDescriptor_lt
 Comparison operator for UnmanagedFileDescriptor. More...
class  ConnectedDescriptor
 A BidirectionalFileDescriptor that also generates notifications when closed. More...
class  LoopbackDescriptor
 A loopback descriptor. More...
class  PipeDescriptor
 A descriptor that uses unix pipes. More...
class  UnixSocket
 A unix domain socket pair. More...
class  DeviceDescriptor
 A descriptor which represents a connection to a device. More...
class  LinuxHelper
 A static class containing platform-specific helper code for Linux. More...
class  InputBufferInterface
class  InputStreamInterface
class  InputStream
class  IOQueue
class  IOStack
struct  IOVec
class  IOVecInterface
class  MemoryBlock
 A MemoryBlock encapsulates a chunk of memory. It's used by the IOQueue and IOStack classes. More...
class  MemoryBlockPool
 MemoryBlockPool. This class is not thread safe. More...
class  MemoryBuffer
class  NonBlockingSender
 Write data to ConnectedDescriptors without blocking or losing data. More...
class  OutputBufferInterface
class  OutputStreamInterface
class  OutputStream
class  SelectServer
 A single threaded I/O event management system. More...
class  SelectServerInterface
 The interface for the SelectServer. More...
class  StdinHandler

Typedefs

typedef int DescriptorHandle

Enumerations

enum  baud_rate {
  BAUD_RATE_9600 = 9600, BAUD_RATE_19200 = 19200, BAUD_RATE_38400 = 38400, BAUD_RATE_57600 = 57600,
  BAUD_RATE_115200 = 115200, BAUD_RATE_230400 = 230400
}

Functions

 STATIC_ASSERT (sizeof(struct iovec)==sizeof(struct IOVec))
int ToFD (const DescriptorHandle &handle)
bool CreatePipe (DescriptorHandle handle_pair[2])
bool Open (const std::string &path, int oflag, int *fd)
 Wrapper around open().
bool TryOpen (const std::string &path, int oflag, int *fd)
 Wrapper around open().
template<typename T >
bool InsertIntoDescriptorMap (map< int, T * > *descriptor_map, int fd, T *value, const string &type)
 Insert a descriptor into one of the descriptor maps.
template<typename T >
bool RemoveFromDescriptorMap (map< int, T * > *descriptor_map, int fd)
 Remove a FD from a descriptor map by setting the value to NULL.
bool UIntToSpeedT (uint32_t value, speed_t *output)
 Convert an integer baud rate to the termios struct speed_t.
void CancelIOs (vector< PollData * > *data)

Variables

static const int FLAG_READ = 1
static const int FLAG_WRITE = 2
static DescriptorHandle INVALID_DESCRIPTOR = -1

Function Documentation

bool ola::io::CreatePipe ( DescriptorHandle  handle_pair[2])

Helper function to create a anonymous pipe

Parameters
handle_paira 2 element array which is updated with the handles
Returns
true if successful, false otherwise.
template<typename T >
bool ola::io::InsertIntoDescriptorMap ( map< int, T * > *  descriptor_map,
int  fd,
T *  value,
const string &  type 
)

Insert a descriptor into one of the descriptor maps.

Parameters
descriptor_mapthe descriptor_map to insert into.
fdthe FD to use as the key
valuethe value to associate with the key
typethe name of the map, used for logging if the fd already exists in the map.
Returns
true if the descriptor was inserted, false if it was already in the map.

There are three possibilities:

  • The fd does not already exist in the map
  • The fd exists and the value is NULL.
  • The fd exists and is not NULL.
bool ola::io::Open ( const std::string &  path,
int  oflag,
int *  fd 
)

Wrapper around open().

This logs a message if the open fails.

Parameters
paththe path to open
oflagflags passed to open
[out]fda pointer to the fd which is returned.
Returns
true if the open succeeded, false otherwise.
template<typename T >
bool ola::io::RemoveFromDescriptorMap ( map< int, T * > *  descriptor_map,
int  fd 
)

Remove a FD from a descriptor map by setting the value to NULL.

Returns
true if the FD was removed from the map, false if it didn't exist in the map.
bool ola::io::TryOpen ( const std::string &  path,
int  oflag,
int *  fd 
)

Wrapper around open().

This is similar to Open(), but doesn't log a warning if open() fails.

Parameters
paththe path to open
oflagflags passed to open
[out]fda pointer to the fd which is returned.
Returns
true if the open succeeded, false otherwise.
See Also
Open
bool ola::io::UIntToSpeedT ( uint32_t  value,
speed_t *  output 
)

Convert an integer baud rate to the termios struct speed_t.

Parameters
[in]valuethe baudrate value to convert
[out]outputa pointer where the value will be stored
Returns
true if the value was converted, false if the baud rate wasn't supported by the method.