gnFileSource Class Reference

gnFileSource is a standard interface to all file based sources of genetic information. More...

#include <gnFileSource.h>

Inheritance diagram for gnFileSource:

Inheritance graph
[legend]
Collaboration diagram for gnFileSource:

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual gnFileSourceClone () const=0
virtual void Close ()
 Closes the file or connection this source is reading from.

virtual gnFileContigGetFileContig (const uint32 contigI) const=0
 Returns a pointer to the file contig corresponding to contigI or null if none exists.

virtual const gnFilterGetFilter () const
 Get the filter currently being used to filter unwanted characters out of read sequences.

virtual string GetOpenString () const
 Get the location of the source that is being used.

 gnFileSource (const gnFileSource &gnfs)
 gnFileSource ()
virtual void Open ()
 Opens this source for reading.

virtual void Open (string openString)
 Opens the source given in "openString" for reading.

virtual boolean Read (const uint64 pos, char *buf, gnSeqI &bufLen)
 Gets raw input from this source.

virtual void SetFilter (gnFilter *filter)
 Set the filter that will be used to filter unwanted characters out of the sequence data.

virtual ~gnFileSource ()

Protected Member Functions

void DetermineNewlineType ()

Protected Attributes

ifstream m_ifstream
uint32 m_newlineSize
gnNewlineType m_newlineType
string m_openString
const gnFilterm_pFilter

Private Member Functions

virtual boolean ParseStream (istream &fin)=0

Detailed Description

gnFileSource is a standard interface to all file based sources of genetic information.

All file source classes are derived from this class.

Definition at line 27 of file gnFileSource.h.


Constructor & Destructor Documentation

gnFileSource::gnFileSource  )  [inline]
 

Definition at line 30 of file gnFileSource.h.

gnFileSource::gnFileSource const gnFileSource gnfs  ) 
 

Definition at line 18 of file gnFileSource.cpp.

References m_ifstream, m_newlineSize, m_newlineType, m_openString, and m_pFilter.

virtual gnFileSource::~gnFileSource  )  [inline, virtual]
 

Definition at line 32 of file gnFileSource.h.


Member Function Documentation

virtual gnFileSource* gnFileSource::Clone  )  const [pure virtual]
 

Implements gnBaseSource.

Implemented in gnABISource, gnDNXSource, gnFASSource, gnGBKSource, gnRAWSource, and gnSEQSource.

void gnFileSource::Close  )  [virtual]
 

Closes the file or connection this source is reading from.

Exceptions:
IOStreamError if an error occurs closing the file.

Implements gnBaseSource.

Definition at line 56 of file gnFileSource.cpp.

References m_ifstream, and Throw_gnEx.

void gnFileSource::DetermineNewlineType  )  [protected]
 

Definition at line 74 of file gnFileSource.cpp.

References gnNewlineMac, gnNewlineUnix, gnNewlineWindows, m_ifstream, m_newlineSize, and m_newlineType.

Referenced by gnGBKSource::ParseStream(), and gnFASSource::ParseStream().

virtual gnFileContig* gnFileSource::GetFileContig const uint32  contigI  )  const [pure virtual]
 

Returns a pointer to the file contig corresponding to contigI or null if none exists.

Implemented in gnABISource, gnDNXSource, gnFASSource, gnGBKSource, gnRAWSource, and gnSEQSource.

const gnFilter * gnFileSource::GetFilter  )  const [inline, virtual]
 

Get the filter currently being used to filter unwanted characters out of read sequences.

Returns:
A pointer to the gnFilter currently in use.

Implements gnBaseSource.

Definition at line 68 of file gnFileSource.h.

References m_pFilter.

string gnFileSource::GetOpenString  )  const [inline, virtual]
 

Get the location of the source that is being used.

Returns:
The location string describing this source, usually a file name.

Implements gnBaseSource.

Definition at line 62 of file gnFileSource.h.

References m_openString.

void gnFileSource::Open  )  [virtual]
 

Opens this source for reading.

Exceptions:
Will throw a FileNotOpened exception if the file was not found or was not accessible.

Implements gnBaseSource.

Definition at line 48 of file gnFileSource.cpp.

References m_ifstream, m_openString, and Throw_gnEx.

void gnFileSource::Open string  openString  )  [virtual]
 

Opens the source given in "openString" for reading.

Parameters:
openString The name of the source (file, network URL, or database) to open.
Exceptions:
Will throw a FileNotOpened exception if the file was not found or was not accessible. Will propagate a FileUnreadable exception if the file format was invalid.

Implements gnBaseSource.

Definition at line 29 of file gnFileSource.cpp.

References m_ifstream, m_openString, ParseStream(), and Throw_gnEx.

Referenced by main().

virtual boolean gnFileSource::ParseStream istream &  fin  )  [private, pure virtual]
 

Implemented in gnABISource, gnDNXSource, gnFASSource, gnGBKSource, gnRAWSource, and gnSEQSource.

Referenced by Open().

boolean gnFileSource::Read const uint64  pos,
char *  buf,
gnSeqI bufLen
[virtual]
 

Gets raw input from this source.

Read will attempt to read "bufLen" bytes starting at "pos" directly from the source. It stores the data in "buf", and returns the actual number of bytes read in bufLen. Read will return false if a serious error occurs.

Parameters:
pos The position in the file to start reading.
buf The character array to store data into.
bufLen The number of bytes to read.
Returns:
True if the operation was successful.

Implements gnBaseSource.

Definition at line 63 of file gnFileSource.cpp.

References gnSeqI, m_ifstream, and uint64.

Referenced by gnRAWSource::SeqRead().

void gnFileSource::SetFilter gnFilter filter  )  [inline, virtual]
 

Set the filter that will be used to filter unwanted characters out of the sequence data.

Parameters:
filter The filter to remove unwanted characters from the sequence.
Exceptions:
NullPointer is thrown if the specified filter pointer is null.

Implements gnBaseSource.

Definition at line 74 of file gnFileSource.h.

References m_pFilter, and Throw_gnEx.


Member Data Documentation

ifstream gnFileSource::m_ifstream [protected]
 

Definition at line 53 of file gnFileSource.h.

Referenced by Close(), DetermineNewlineType(), gnFileSource(), Open(), and Read().

uint32 gnFileSource::m_newlineSize [protected]
 

Definition at line 56 of file gnFileSource.h.

Referenced by DetermineNewlineType(), and gnFileSource().

gnNewlineType gnFileSource::m_newlineType [protected]
 

Definition at line 55 of file gnFileSource.h.

Referenced by DetermineNewlineType(), and gnFileSource().

string gnFileSource::m_openString [protected]
 

Definition at line 52 of file gnFileSource.h.

Referenced by GetOpenString(), gnFileSource(), and Open().

const gnFilter* gnFileSource::m_pFilter [protected]
 

Definition at line 54 of file gnFileSource.h.

Referenced by GetFilter(), gnFileSource(), and SetFilter().


The documentation for this class was generated from the following files:
Generated on Mon Mar 28 06:00:58 2005 for libGenome by doxygen 1.3.6