-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBitInputStream.h
More file actions
37 lines (26 loc) · 840 Bytes
/
BitInputStream.h
File metadata and controls
37 lines (26 loc) · 840 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/**
@author Rajdeep Konwar (A53225609)
@date Nov 10 2017
@section OVERVIEW
Declaration of class BitInputStream's member functions.
@section ASSIGNMENT NUMBER
PA3
*/
#ifndef BITINPUTSTREAM_H
#define BITINPUTSTREAM_H
#include <iostream>
using namespace std;
class BitInputStream {
private:
unsigned char buff; //! 1-byte buffer storing 8 bits
int nbits; //! No. of bits that have been read from the buffer
istream ∈ //! Reference to the bytewise input stream
public:
//! Initialize a BitInputStream that will use the given istream for input
BitInputStream( istream &is ) : buff(0), nbits(8), in(is) {}
//! Fill the bitwise buffer by reading one byte from the input stream
void fill();
//! Read 1 bit from the bitwise buffer
unsigned int readBit();
};
#endif // BITINPUTSTREAM_H