OmniSketch  0.1
Oh my sketch!
OmniSketch::Data::StreamData< key_len > Class Template Reference

Store the formatted streaming data. More...

#include <data.h>

Public Member Functions

 StreamData (const std::string_view file_name, const DataFormat &format)
 Construct by specifying input file as well as the data format. More...
 
bool succeed () const
 Return whether data file is successfully parsed. More...
 
bool empty () const
 Check whether the records are read. More...
 
size_t size () const
 Return the number of records in StreamData. More...
 
Stream::const_iterator begin () const
 Return an iterator pointed to the very first record. More...
 
Stream::const_iterator end () const
 Return an iterator pointed to the one after the very last record (in cpp STL manner) More...
 
Stream::const_iterator diff (size_t offset) const
 Return an iterator pointed to the record at given offset. More...
 

Detailed Description

template<int32_t key_len>
class OmniSketch::Data::StreamData< key_len >

Store the formatted streaming data.

Template Parameters
key_lenlength of flowkey

Constructor & Destructor Documentation

◆ StreamData()

template<int32_t key_len>
OmniSketch::Data::StreamData< key_len >::StreamData ( const std::string_view  file_name,
const DataFormat format 
)

Construct by specifying input file as well as the data format.

Parameters
file_namepath to the input file
formatdata format
Note
On failure, records are left empty. Possible reasons for a failure:
  • File does not exist.
  • File is garbled. [i.e., its size is not a multiple of record size]

Member Function Documentation

◆ begin()

template<int32_t key_len>
Stream::const_iterator OmniSketch::Data::StreamData< key_len >::begin ( ) const
inline

Return an iterator pointed to the very first record.

Returns
A random access iterator

◆ diff()

template<int32_t key_len>
Stream::const_iterator OmniSketch::Data::StreamData< key_len >::diff ( size_t  offset) const
inline

Return an iterator pointed to the record at given offset.

Parameters
offsetoffset into the record
Returns
A random access iterator
Note
If the index is out of range, an exception would be thrown.

◆ empty()

template<int32_t key_len>
bool OmniSketch::Data::StreamData< key_len >::empty ( ) const
inline

Check whether the records are read.

Returns
true if not empty. false otherwise.

◆ end()

template<int32_t key_len>
Stream::const_iterator OmniSketch::Data::StreamData< key_len >::end ( ) const
inline

Return an iterator pointed to the one after the very last record (in cpp STL manner)

Returns
A random access iterator

◆ size()

template<int32_t key_len>
size_t OmniSketch::Data::StreamData< key_len >::size ( ) const
inline

Return the number of records in StreamData.

◆ succeed()

template<int32_t key_len>
bool OmniSketch::Data::StreamData< key_len >::succeed ( ) const
inline

Return whether data file is successfully parsed.