// Bit input/output.

#ifndef BITIO_H
#define BITIO_H

#include <iostream>


class bit_packer
{
public:
  bit_packer() : byte(0), count(0) {}
  void write(std::ostream & o, const std::basic_string<bool> & s);
  void flush(std::ostream & o);

private:
  char byte;
  int count;
};


class bit_unpacker
{
public:
  bit_unpacker() : byte(0), count(0) {}
  bool read(std::istream & in);

private:
  char byte;
  int count;
};


#endif
