xapian-core  1.4.26
Public Member Functions | Private Attributes | List of all members
Xapian::BitWriter Class Reference

Create a stream to which non-byte-aligned values can be written. More...

#include <bitstream.h>

+ Collaboration diagram for Xapian::BitWriter:

Public Member Functions

 BitWriter ()
 Construct empty. More...
 
 BitWriter (const std::string &seed)
 Construct with the contents of seed already in the stream. More...
 
void encode (Xapian::termpos value, Xapian::termpos outof)
 Encode value, known to be less than outof. More...
 
std::string & freeze ()
 Finish encoding and return the encoded data as a std::string. More...
 
void encode_interpolative (const std::vector< Xapian::termpos > &pos, int j, int k)
 Perform interpolative encoding of pos elements between j and k. More...
 

Private Attributes

std::string buf
 
int n_bits
 
Xapian::termpos acc
 

Detailed Description

Create a stream to which non-byte-aligned values can be written.

Definition at line 33 of file bitstream.h.

Constructor & Destructor Documentation

◆ BitWriter() [1/2]

Xapian::BitWriter::BitWriter ( )
inline

Construct empty.

Definition at line 40 of file bitstream.h.

◆ BitWriter() [2/2]

Xapian::BitWriter::BitWriter ( const std::string &  seed)
inlineexplicit

Construct with the contents of seed already in the stream.

Definition at line 43 of file bitstream.h.

References encode().

Member Function Documentation

◆ encode()

void Xapian::BitWriter::encode ( Xapian::termpos  value,
Xapian::termpos  outof 
)

Encode value, known to be less than outof.

Definition at line 95 of file bitstream.cc.

References Assert, highest_order_bit(), and Xapian::safe_shl().

Referenced by BitWriter(), GlassPositionListTable::pack(), and ChertPositionListTable::set_positionlist().

◆ encode_interpolative()

void Xapian::BitWriter::encode_interpolative ( const std::vector< Xapian::termpos > &  pos,
int  j,
int  k 
)

Perform interpolative encoding of pos elements between j and k.

Definition at line 157 of file bitstream.cc.

References GeoEncode::encode().

Referenced by freeze(), GlassPositionListTable::pack(), and ChertPositionListTable::set_positionlist().

◆ freeze()

std::string& Xapian::BitWriter::freeze ( )
inline

Finish encoding and return the encoded data as a std::string.

Definition at line 50 of file bitstream.h.

References buf, and encode_interpolative().

Referenced by GlassPositionListTable::pack(), and ChertPositionListTable::set_positionlist().

Member Data Documentation

◆ acc

Xapian::termpos Xapian::BitWriter::acc
private

Definition at line 36 of file bitstream.h.

◆ buf

std::string Xapian::BitWriter::buf
private

Definition at line 34 of file bitstream.h.

Referenced by freeze().

◆ n_bits

int Xapian::BitWriter::n_bits
private

Definition at line 35 of file bitstream.h.


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