ModErn Text Analysis
META Enumerates Textual Applications
Classes | Public Member Functions | Private Attributes | List of all members
meta::index::postings_stream< SecondaryKey, FeatureValue > Class Template Reference

A stream for extracting the postings list for a specific key in a postings file. More...

#include <postings_stream.h>

Classes

struct  char_input_stream
 
class  iterator
 An iterator over the (SecondaryKey, FeatureValue) pairs of this postings list. More...
 

Public Member Functions

 postings_stream (const char *buffer)
 Creates a postings stream reading from the given buffer. More...
 
 postings_stream (const char *buffer, uint64_t size, FeatureValue total_counts)
 Creates a postings stream reading from the given buffer. More...
 
uint64_t size () const
 
FeatureValue total_counts () const
 
template<class OutputStream >
uint64_t write_packed (OutputStream &os) const
 Writes this postings stream to an output stream in packed format. More...
 
iterator begin () const
 
iterator end () const
 

Private Attributes

const char * start_
 
uint64_t size_
 
FeatureValue total_counts_
 

Detailed Description

template<class SecondaryKey, class FeatureValue = uint64_t>
class meta::index::postings_stream< SecondaryKey, FeatureValue >

A stream for extracting the postings list for a specific key in a postings file.

This can be used instead of postings_data to avoid reading in the entire postings list into memory at once.

Constructor & Destructor Documentation

§ postings_stream() [1/2]

template<class SecondaryKey, class FeatureValue = uint64_t>
meta::index::postings_stream< SecondaryKey, FeatureValue >::postings_stream ( const char *  buffer)
inline

Creates a postings stream reading from the given buffer.

Assumes that the size and total counts are the first two values in the buffer.

Parameters
bufferThe buffer position to the start of the postings

§ postings_stream() [2/2]

template<class SecondaryKey, class FeatureValue = uint64_t>
meta::index::postings_stream< SecondaryKey, FeatureValue >::postings_stream ( const char *  buffer,
uint64_t  size,
FeatureValue  total_counts 
)
inline

Creates a postings stream reading from the given buffer.

Assumes that the very first value in the buffer is the start of the postings, since the size and total counts are provided on construction.

Member Function Documentation

§ size()

template<class SecondaryKey, class FeatureValue = uint64_t>
uint64_t meta::index::postings_stream< SecondaryKey, FeatureValue >::size ( ) const
inline
Returns
the number of SecondaryKeys in this postings list.

§ total_counts()

template<class SecondaryKey, class FeatureValue = uint64_t>
FeatureValue meta::index::postings_stream< SecondaryKey, FeatureValue >::total_counts ( ) const
inline
Returns
the total sum of the counts for SecondaryKeys in this postings list.

§ write_packed()

template<class SecondaryKey, class FeatureValue = uint64_t>
template<class OutputStream >
uint64_t meta::index::postings_stream< SecondaryKey, FeatureValue >::write_packed ( OutputStream &  os) const
inline

Writes this postings stream to an output stream in packed format.

Returns
the number of bytes written

§ begin()

template<class SecondaryKey, class FeatureValue = uint64_t>
iterator meta::index::postings_stream< SecondaryKey, FeatureValue >::begin ( ) const
inline
Returns
an iterator to the beginning of the list

§ end()

template<class SecondaryKey, class FeatureValue = uint64_t>
iterator meta::index::postings_stream< SecondaryKey, FeatureValue >::end ( ) const
inline
Returns
an iterator to the ending of the list

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