LibNRG  0.0.1
Networking for Real-time Games library
 All Classes Files Functions Variables Friends
nrg::BitWriter Class Reference

Writes a stream of bytes to a packet more easily.

#include <nrg_bit_io.h>

Public Member Functions

 BitWriter (Packet &p)
 Constructor a BitWriter that will read from the Packet p.
 
void write (bool b)
 Write a 1 or 0 if b is true or false respectively.
 
void write1 ()
 Write a 1 bit.
 
void write0 ()
 Write a 0 bit.
 
template<class T >
void writeFunc (int sz, const T &fn)
 Calls BitWriter::write using the bool return value from the function fn sz times.
 
void flush (void)
 Finishes writing bits to the packet, and resets the internal state.
 
void clear ()
 Resets the internal set of bits that have not yet been written.
 
 ~BitWriter ()
 Destructor, which will call BitWriter::flush.
 

The documentation for this class was generated from the following file: