vg
tools for working with variation graphs
Public Member Functions | Public Attributes | List of all members
vg::GAFSorterFile Struct Reference

#include <gaf_sorter.hpp>

Public Member Functions

 GAFSorterFile ()
 Default constructor that creates a compressed temporary file. More...
 
 GAFSorterFile (const std::string &name)
 Constructor that creates a raw GAF file with the given name. More...
 
 ~GAFSorterFile ()
 If the file is temporary, the destructor removes the file. More...
 
 GAFSorterFile (const GAFSorterFile &)=delete
 
GAFSorterFileoperator= (const GAFSorterFile &)=delete
 
 GAFSorterFile (GAFSorterFile &&)=default
 
GAFSorterFileoperator= (GAFSorterFile &&)=default
 
std::pair< std::ostream *, std::unique_ptr< std::ostream > > open_output ()
 
void write (const GAFSorterRecord &record, std::ostream &out)
 
std::pair< std::istream *, std::unique_ptr< std::istream > > open_input ()
 
void read (GAFSorterRecord &record, std::istream &in)
 
bool is_std_in_out () const
 
void remove_temporary ()
 Removes the file if it is temporary. More...
 

Public Attributes

std::string name
 File name. More...
 
size_t records
 Number of records. More...
 
bool temporary
 Is this a temporary file created with temp_file::create()? More...
 
bool compressed
 Is this file compressed? More...
 
bool raw_gaf
 Is this a raw GAF file? More...
 
bool removed
 Has the file been removed? More...
 
bool ok
 Success flag. More...
 

Detailed Description

A file of GAFSorterRecords or GAF lines.

The records are sorted in increasing order by key. The object is movable but not copyable.

Constructor & Destructor Documentation

◆ GAFSorterFile() [1/4]

vg::GAFSorterFile::GAFSorterFile ( )

Default constructor that creates a compressed temporary file.

◆ GAFSorterFile() [2/4]

vg::GAFSorterFile::GAFSorterFile ( const std::string &  name)
explicit

Constructor that creates a raw GAF file with the given name.

◆ ~GAFSorterFile()

vg::GAFSorterFile::~GAFSorterFile ( )

If the file is temporary, the destructor removes the file.

◆ GAFSorterFile() [3/4]

vg::GAFSorterFile::GAFSorterFile ( const GAFSorterFile )
delete

◆ GAFSorterFile() [4/4]

vg::GAFSorterFile::GAFSorterFile ( GAFSorterFile &&  )
default

Member Function Documentation

◆ is_std_in_out()

bool vg::GAFSorterFile::is_std_in_out ( ) const
inline

Returns true if the file is actually stdin/stdout. In that case, open_input() should not be called.

◆ open_input()

std::pair< std::istream *, std::unique_ptr< std::istream > > vg::GAFSorterFile::open_input ( )

Returns an input stream to the file. The first return value is the actual stream. The second return value is a unique pointer which may contain a newly created stream. Sets the success flag.

◆ open_output()

std::pair< std::ostream *, std::unique_ptr< std::ostream > > vg::GAFSorterFile::open_output ( )

Returns an output stream to the file. The first return value is the actual stream. The second return value is a unique pointer which may contain a newly created stream. Sets the success flag.

◆ operator=() [1/2]

GAFSorterFile& vg::GAFSorterFile::operator= ( const GAFSorterFile )
delete

◆ operator=() [2/2]

GAFSorterFile& vg::GAFSorterFile::operator= ( GAFSorterFile &&  )
default

◆ read()

void vg::GAFSorterFile::read ( GAFSorterRecord record,
std::istream &  in 
)
inline

Reads the next record from the file, assuming that this is not a raw GAF file. Sets the success flag.

◆ remove_temporary()

void vg::GAFSorterFile::remove_temporary ( )

Removes the file if it is temporary.

◆ write()

void vg::GAFSorterFile::write ( const GAFSorterRecord record,
std::ostream &  out 
)
inline

Writes the record to the file. Updates the number of records and sets the success flag.

Member Data Documentation

◆ compressed

bool vg::GAFSorterFile::compressed

Is this file compressed?

◆ name

std::string vg::GAFSorterFile::name

File name.

◆ ok

bool vg::GAFSorterFile::ok

Success flag.

◆ raw_gaf

bool vg::GAFSorterFile::raw_gaf

Is this a raw GAF file?

◆ records

size_t vg::GAFSorterFile::records

Number of records.

◆ removed

bool vg::GAFSorterFile::removed

Has the file been removed?

◆ temporary

bool vg::GAFSorterFile::temporary

Is this a temporary file created with temp_file::create()?


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