A library for working with phylogenetic and population genetic data.
v0.32.0
FileInputSource Class Referencefinal

#include <genesis/utils/io/file_input_source.hpp>

Inherits BaseInputSource.

Detailed Description

Input source for reading byte data from a file.

The input file name is provided via the constructor.

It is also possible to provide a FILE pointer directly. In this case, the ownership of the file pointer is taken by this class. Thus, closing the file is done when destructing this class.

Definition at line 60 of file file_input_source.hpp.

Public Member Functions

 FileInputSource (FileInputSource &&)=default
 
 FileInputSource (FileInputSource const &)=default
 
 FileInputSource (std::string const &file_name)
 Construct the input source from a file with the given file name. More...
 
 FileInputSource (std::string const &file_name, FILE *file)
 Construct the input source from a FILE pointer. The file_name is used for the source_name() function only. More...
 
 ~FileInputSource () override
 
FileInputSourceoperator= (FileInputSource &&)=default
 
FileInputSourceoperator= (FileInputSource const &)=default
 
- Public Member Functions inherited from BaseInputSource
 BaseInputSource ()=default
 
 BaseInputSource (BaseInputSource &&)=default
 
 BaseInputSource (BaseInputSource const &)=default
 
virtual ~BaseInputSource ()
 
bool is_trivial () const
 Return whether reading from this source is trivial, such as reading from a file, or involves more complex operations, such as reading from a compressed input that needs to be decompressed first. More...
 
BaseInputSourceoperator= (BaseInputSource &&)=default
 
BaseInputSourceoperator= (BaseInputSource const &)=default
 
size_t read (char *buffer, size_t size)
 Read size many bytes into the char buffer. More...
 
std::string source_name () const
 Get a name of the input source. This is intended for user output. More...
 
std::string source_string () const
 Get a string representing the input source. This is intended for the reader classes, which for example might want to examine the input file name. More...
 

Constructor & Destructor Documentation

◆ FileInputSource() [1/4]

FileInputSource ( std::string const &  file_name)
inlineexplicit

Construct the input source from a file with the given file name.

Definition at line 71 of file file_input_source.hpp.

◆ FileInputSource() [2/4]

FileInputSource ( std::string const &  file_name,
FILE *  file 
)
inlineexplicit

Construct the input source from a FILE pointer. The file_name is used for the source_name() function only.

Definition at line 86 of file file_input_source.hpp.

◆ FileInputSource() [3/4]

FileInputSource ( FileInputSource const &  )
default

◆ FileInputSource() [4/4]

FileInputSource ( FileInputSource &&  )
default

◆ ~FileInputSource()

~FileInputSource ( )
inlineoverride

Definition at line 100 of file file_input_source.hpp.

Member Function Documentation

◆ operator=() [1/2]

FileInputSource& operator= ( FileInputSource &&  )
default

◆ operator=() [2/2]

FileInputSource& operator= ( FileInputSource const &  )
default

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