SHORE API
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
shore::row_reader Class Reference

Read tab delimited entries from plain text files. More...

Public Types

typedef std::vector< std::string > current_type
 

Public Member Functions

 row_reader (const std::string &fn, const std::vector< std::string > &colspec, line_reader::compare_type cmp=line_reader::compare_type())
 
 row_reader (const std::string &fn, const size_t ncol, line_reader::compare_type cmp=line_reader::compare_type())
 Use columns 1..ncol.
 
template<typename Iterator >
 row_reader (const std::string &fn, Iterator bcolspec, Iterator ecolspec, line_reader::compare_type cmp=line_reader::compare_type())
 
 row_reader (const std::string &fn, const std::vector< std::string > &colspec, shore::slot< const std::string & > &mdslot, line_reader::compare_type cmp=line_reader::compare_type())
 
template<typename Iterator >
 row_reader (const std::string &fn, Iterator bcolspec, Iterator ecolspec, shore::slot< const std::string & > &mdslot, line_reader::compare_type cmp=line_reader::compare_type())
 
 row_reader (std::istream *const in, const std::vector< std::string > &colspec, line_reader::compare_type cmp=line_reader::compare_type())
 
template<typename Iterator >
 row_reader (std::istream *const in, Iterator bcolspec, Iterator ecolspec, line_reader::compare_type cmp=line_reader::compare_type())
 
 row_reader (std::istream *const in, const std::vector< std::string > &colspec, shore::slot< const std::string & > &mdslot, line_reader::compare_type cmp=line_reader::compare_type())
 
template<typename Iterator >
 row_reader (std::istream *const in, Iterator bcolspec, Iterator ecolspec, shore::slot< const std::string & > &mdslot, line_reader::compare_type cmp=line_reader::compare_type())
 
 row_reader (const std::string &fn, const std::string &colspec, line_reader::compare_type cmp=line_reader::compare_type())
 
 row_reader (const std::string &fn, const std::string &colspec, shore::slot< const std::string & > &mdslot, line_reader::compare_type cmp=line_reader::compare_type())
 
 row_reader (std::istream *const in, const std::string &colspec, line_reader::compare_type cmp=line_reader::compare_type())
 
 row_reader (std::istream *const in, const std::string &colspec, shore::slot< const std::string & > &mdslot, line_reader::compare_type cmp=line_reader::compare_type())
 
shore::signal< const
std::string & > & 
sigmetadata ()
 
row_readerset_commentchar (const char c)
 
void set_optional (const std::string &columnname)
 Indicate that a named column may be missing from the file. More...
 
const std::string & get_header () const
 
bool has_data ()
 
const std::vector< std::string > & current () const
 
void next ()
 
const std::string & current_line () const
 
void edit (const size_t col, const std::string &s)
 
const std::string & current_edit ()
 
std::string spec_str ()
 
size_t get_filecol (const size_t readercol)
 
void seek (const std::streampos position)
 

Detailed Description

Read tab delimited entries from plain text files.

The reader provides the columns specified in the constructor, independent of their actual order in the input file. Columns may be requested by name, e.g. "chromosome\tposition", or by column number prefixed with an '@', e.g. "@2\t@4". Negative numbers are counted from the last column, e.g. @-2 refers to the next-to-last column.

Member Function Documentation

void shore::row_reader::set_optional ( const std::string &  columnname)

Indicate that a named column may be missing from the file.

When a named column, e.g. 'chromosome', is requested, the reader throws an exception if this column is not found in the input file, unless it is set as optional. Meaningless for columns specified by position, e.g. '@2'.


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