Vowpal Wabbit
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | List of all members
VW::io_buf Class Reference

#include <io_buf.h>

Public Member Functions

 io_buf ()
 
 io_buf (io_buf &other)=delete
 
io_bufoperator= (io_buf &other)=delete
 
 io_buf (io_buf &&other)=delete
 
io_bufoperator= (io_buf &&other)=delete
 
const std::vector< std::unique_ptr< VW::io::reader > > & get_input_files () const
 
const std::vector< std::unique_ptr< VW::io::writer > > & get_output_files () const
 
void verify_hash (bool verify)
 
uint32_t hash ()
 
void add_file (std::unique_ptr< VW::io::reader > &&file)
 
void add_file (std::unique_ptr< VW::io::writer > &&file)
 
void reset ()
 Calls reset on all contained input files. Moves back to the first file being the current one processed and resets the buffer position. If the contained readers are not resettable then this function will fail. The buffer should be tested with io_buf::is_resettable prior to calling this to avoid failure. More...
 
bool is_resettable () const
 Test if this io_buf supports resetting. More...
 
void set (char *p)
 
size_t num_files () const
 This function will return the number of input files AS WELL AS the number of output files. (because of legacy) More...
 
size_t num_input_files () const
 
size_t num_output_files () const
 
ssize_t fill (VW::io::reader *f)
 
size_t unflushed_bytes_count ()
 
void flush ()
 
bool close_file ()
 
void close_files ()
 
template<typename T , typename std::enable_if<!std::is_pointer< T >::value &&std::is_trivially_copyable< T >::value, bool >::type = true>
size_t write_value (const T &value)
 
template<typename T , typename std::enable_if<!std::is_pointer< T >::value &&std::is_trivially_copyable< T >::value, bool >::type = true>
read_value (VW::string_view debug_name="")
 
template<typename T , typename std::enable_if<!std::is_pointer< T >::value &&std::is_trivially_copyable< T >::value, bool >::type = true>
read_value_and_accumulate_size (VW::string_view debug_name, size_t &size)
 
void buf_write (char *&pointer, size_t n)
 
size_t buf_read (char *&pointer, size_t n, desired_align align=known_alignments::TEXT)
 
size_t bin_read_fixed (char *data, size_t len)
 
size_t bin_write_fixed (const char *data, size_t len)
 
bool isbinary ()
 
size_t readto (char *&pointer, char terminal)
 
size_t copy_to (void *dst, size_t max_size)
 
void replace_buffer (char *buf, size_t capacity)
 
char * buffer_start ()
 

Static Public Member Functions

static ssize_t read_file (VW::io::reader *f, void *buf, size_t nbytes)
 

Constructor & Destructor Documentation

◆ io_buf() [1/3]

VW::io_buf::io_buf ( )
inline

◆ io_buf() [2/3]

VW::io_buf::io_buf ( io_buf other)
delete

◆ io_buf() [3/3]

VW::io_buf::io_buf ( io_buf &&  other)
delete

Member Function Documentation

◆ add_file() [1/2]

void VW::io_buf::add_file ( std::unique_ptr< VW::io::reader > &&  file)
inline

◆ add_file() [2/2]

void VW::io_buf::add_file ( std::unique_ptr< VW::io::writer > &&  file)
inline

◆ bin_read_fixed()

size_t VW::io_buf::bin_read_fixed ( char *  data,
size_t  len 
)
inline

◆ bin_write_fixed()

size_t VW::io_buf::bin_write_fixed ( const char *  data,
size_t  len 
)
inline

◆ buf_read()

size_t VW::io_buf::buf_read ( char *&  pointer,
size_t  n,
desired_align  align = known_alignments::TEXT 
)

◆ buf_write()

void VW::io_buf::buf_write ( char *&  pointer,
size_t  n 
)

◆ buffer_start()

char * VW::io_buf::buffer_start ( )
inline

◆ close_file()

bool VW::io_buf::close_file ( )
inline

◆ close_files()

void VW::io_buf::close_files ( )
inline

◆ copy_to()

size_t VW::io_buf::copy_to ( void *  dst,
size_t  max_size 
)

◆ fill()

ssize_t VW::io_buf::fill ( VW::io::reader f)
inline

◆ flush()

void VW::io_buf::flush ( )

◆ get_input_files()

const std::vector< std::unique_ptr< VW::io::reader > > & VW::io_buf::get_input_files ( ) const
inline

◆ get_output_files()

const std::vector< std::unique_ptr< VW::io::writer > > & VW::io_buf::get_output_files ( ) const
inline

◆ hash()

uint32_t VW::io_buf::hash ( )
inline

◆ is_resettable()

bool VW::io_buf::is_resettable ( ) const

Test if this io_buf supports resetting.

Returns
true if all contained input files can be reset
false if any contained input files cannot be reset

◆ isbinary()

bool VW::io_buf::isbinary ( )

◆ num_files()

size_t VW::io_buf::num_files ( ) const
inline

This function will return the number of input files AS WELL AS the number of output files. (because of legacy)

◆ num_input_files()

size_t VW::io_buf::num_input_files ( ) const
inline

◆ num_output_files()

size_t VW::io_buf::num_output_files ( ) const
inline

◆ operator=() [1/2]

io_buf & VW::io_buf::operator= ( io_buf &&  other)
delete

◆ operator=() [2/2]

io_buf & VW::io_buf::operator= ( io_buf other)
delete

◆ read_file()

static ssize_t VW::io_buf::read_file ( VW::io::reader f,
void *  buf,
size_t  nbytes 
)
inlinestatic

◆ read_value()

template<typename T , typename std::enable_if<!std::is_pointer< T >::value &&std::is_trivially_copyable< T >::value, bool >::type = true>
T VW::io_buf::read_value ( VW::string_view  debug_name = "")
inline

◆ read_value_and_accumulate_size()

template<typename T , typename std::enable_if<!std::is_pointer< T >::value &&std::is_trivially_copyable< T >::value, bool >::type = true>
T VW::io_buf::read_value_and_accumulate_size ( VW::string_view  debug_name,
size_t &  size 
)
inline

◆ readto()

size_t VW::io_buf::readto ( char *&  pointer,
char  terminal 
)

◆ replace_buffer()

void VW::io_buf::replace_buffer ( char *  buf,
size_t  capacity 
)

◆ reset()

void VW::io_buf::reset ( )

Calls reset on all contained input files. Moves back to the first file being the current one processed and resets the buffer position. If the contained readers are not resettable then this function will fail. The buffer should be tested with io_buf::is_resettable prior to calling this to avoid failure.

◆ set()

void VW::io_buf::set ( char *  p)
inline

◆ unflushed_bytes_count()

size_t VW::io_buf::unflushed_bytes_count ( )
inline

◆ verify_hash()

void VW::io_buf::verify_hash ( bool  verify)
inline

◆ write_value()

template<typename T , typename std::enable_if<!std::is_pointer< T >::value &&std::is_trivially_copyable< T >::value, bool >::type = true>
size_t VW::io_buf::write_value ( const T &  value)
inline

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