/* Blinker
   Copyright 2011-2019 Stefan Schuermans <stefan@blinkenarea.org>
   Copyleft GNU public license - http://www.gnu.org/copyleft/gpl.html
   a blinkenarea.org project */

#ifndef BLINKER_IO_H
#define BLINKER_IO_H

#include <set>

#include "Time.h"

namespace Blinker {

/// base class for I/O objects
class Io
{
public:
  /// set of I/O objects
  typedef std::set<Io *> Set;

public:
  /**
   * @brief wait for I/O events
   * @param[in] read I/O objects to check for readability
   * @param[out] read I/O objects that are readable
   * @param[in] write I/O objects to check for writability
   * @param[out] write I/O objects that are writable
   * @param[in] timeout maximum time to wait
   */
  static void wait(Set &read, Set &write, const Time &timeout);

public:
  /// constructor
  Io();

private:
  /// copy constructor disabled
  Io(const Io &that);

  /// assignment operator disabled
  const Io & operator=(const Io &that);

protected:
  int m_fd; ///< file descriptor
}; // class Io

} // namespace Blinker

#endif // #ifndef BLINKER_IO_H

