Sample SNPs
Fast ordered sampling of rows from large text or binary files. Special cases for DNA variant files (.bed, VCF, HapMap, etc).
Public Member Functions | Protected Attributes | List of all members
sampFiles::GbinFile Class Reference

Generic binary file base class. More...

#include <varfiles.hpp>

Inheritance diagram for sampFiles::GbinFile:
[legend]
Collaboration diagram for sampFiles::GbinFile:
[legend]

Public Member Functions

 GbinFile ()
 Default constructor.
 
 GbinFile (const string &fileName, const size_t &nCols, const size_t &elemSize)
 Constructor with file name. More...
 
 GbinFile (const GbinFile &in)=default
 Copy constructor.
 
GbinFileoperator= (const GbinFile &in)=default
 Copy assignment.
 
 GbinFile (GbinFile &&in)=default
 Move constructor.
 
GbinFileoperator= (GbinFile &&in)=default
 Move assignment.
 
 ~GbinFile ()
 Destructor.
 
virtual void open ()
 Open stream (does nothing)
 
virtual void close ()
 Close stream.
 
- Public Member Functions inherited from sampFiles::VarFile
 VarFile (const VarFile &in)=default
 Copy constructor.
 
VarFileoperator= (const VarFile &in)=default
 Copy assignment.
 
 VarFile (VarFile &&in)=default
 Move constructor.
 
VarFileoperator= (VarFile &&in)=default
 Move assignment.
 
 ~VarFile ()
 Destructor.
 

Protected Attributes

string _fileName
 File name.
 
size_t _nCols
 Number of elements in a row.
 
size_t _elemSize
 Size of each element in bytes.
 
- Protected Attributes inherited from sampFiles::VarFile
fstream _varFile
 Variant file stream.
 

Additional Inherited Members

- Protected Member Functions inherited from sampFiles::VarFile
 VarFile ()
 Default constructor (protected)
 

Detailed Description

Generic binary file base class.

Sets up streams for binary files. No support for header lines.

Constructor & Destructor Documentation

◆ GbinFile()

sampFiles::GbinFile::GbinFile ( const string &  fileName,
const size_t &  nCols,
const size_t &  elemSize 
)
inline

Constructor with file name.

Throws `‘Number of elements not divisible by the number of columns’' if the total number of elements is not divisible by the number of elements in a column.

Parameters
[in]fileNamefile name
[in]nColsnumber of columns, or elements in a row
[in]elemSizesize of each element in bytes

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