Class
FormattedFileBase class for formatted file I/O.
Base class for formatted file I/O.
All Subcl's | BamFileIn, BamFileOut, BedFileIn, BedFileOut, BlastReportFileOut, BlastTabularFileIn, BlastTabularFileOut, FormattedFileIn, FormattedFileOut, GffFileIn, GffFileOut, RnaStructFileIn, RnaStructFileOut, RoiFileIn, RoiFileOut, SeqFileIn, SeqFileOut, SimpleIntervalsFileIn, SimpleIntervalsFileInOut, UcscFileIn, UcscFileOut, VcfFileIn, VcfFileOut |
---|---|
Defined in | <seqan/stream.h> |
Signature |
template <typename TFileFormat, typename TDirection[, typename TSpec]>
struct FormattedFile;
|
Template Parameters
TFileFormat |
A type specifying the file format. |
---|---|
TDirection |
The direction of the file, one of Input or Output. |
TSpec |
A tag for the specialization, defauls to void. |
Member Function Overview
-
TExtensionVector getFileExtensions()
Static function that returns a list of allowed file format extension. -
TDependentContext & FormattedFile::operator TDependentContext();
Allows conversion to a dependent context for the FormattedFile
Interface Function Overview
-
bool atEnd(file);
Determines whether a FormattedFile is at the end. -
bool close(file);
Close a FormattedFile. -
TDependentContext & context(file);
Return the FormattedFile's dependent context object. -
TFormat format(file);
Return the format of a FormattedFile. -
FormattedFile::FormattedFile();, FormattedFile::FormattedFile(fileName[, openMode]);, FormattedFile::FormattedFile(stream);, FormattedFile::FormattedFile(other);, FormattedFile::FormattedFile(otherContext);, FormattedFile::FormattedFile(otherContext, fileName[, openMode]);, FormattedFile::FormattedFile(otherContext, stream);
Provides default construction. -
TExtensionVector getFileExtensions(file)
Static function that returns a list of allowed file format extension. -
bool guessFormat(file);
Guess the format of an open FormattedFile. -
bool isOpen(file);
Determines whether a FormattedFile is currently open. -
bool open(file, fileName, mode);
Open a FormattedFile. -
void setFormat(file, format);
Set the format of a FormattedFile.
Interface Metafunction Overview
-
FileFormat<TFormattedFile>::Type;
Metafunction for retrieving the file format type of a formatted file. -
FormattedFileContext<TFormattedFile, TStorageSpec>::Type
Returns the context type for a FormattedFile.
Detailed Description
FormattedFile provides the following basic I/O operations on formatted files:
- Open a file given its filename or attach to an existing stream like stdin/stdout.
- Guess the file format from the file content or filename extension.
- Set the file format manually.
- Access compressed or uncompressed files transparently.
FormattedFile encapsulates a VirtualStream and provides access to its DirectionIterator. Each instance of FormattedFile keeps a FormattedFileContext while reading or writing the formatted file.
Member Functions Detail
TExtensionVector getFileExtensions()
Static function that returns a list of allowed file format extension.
Returns
TExtensionVector |
A std::vector<std::string> with the allowed file extensions. |
---|
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
TDependentContext & FormattedFile::operator TDependentContext();
Allows conversion to a dependent context for the FormattedFile
Returns
TDependentContext |
The dependent context of this FormattedFile. |
---|
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
Interface Functions Detail
bool atEnd(file);
Determines whether a FormattedFile is at the end.
Parameters
file
|
The FormattedFile to check. |
---|
Returns
bool |
true in the case of success, false otherwise. |
---|
Data Races
Not thread safe.
bool close(file);
Close a FormattedFile.
Parameters
file
|
The FormattedFile to close. |
---|
Returns
bool |
true in the case of success, false otherwise. |
---|
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
TDependentContext & context(file);
Return the FormattedFile's dependent context object.
Parameters
file
|
The FormattedFile to query for its context. |
---|
Returns
TDependentContext |
The dependent context, type as returned from FormattedFileContext. |
---|
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
TFormat format(file);
Return the format of a FormattedFile.
Parameters
file
|
The FormattedFile to check. |
---|
Returns
TFormat |
The type as returned from FileFormat. |
---|
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
FormattedFile::FormattedFile();
FormattedFile::FormattedFile(fileName[, openMode]);
FormattedFile::FormattedFile(stream);
FormattedFile::FormattedFile(other);
FormattedFile::FormattedFile(otherContext);
FormattedFile::FormattedFile(otherContext, fileName[, openMode]);
FormattedFile::FormattedFile(otherContext, stream);
Provides default construction.
Parameters
fileName
|
Path to file to open, char const *. |
---|---|
openMode
|
Optionally, the file open mode, default obtained from TDirection. |
stream
|
A std::basic_istream<> to read from or std::basic_ostream<> to write to, depending on TDirection. |
other
|
A second FormattedFile, this FormattedFile's dependent context will depend on other's dependent context. |
otherContext
|
The dependent context of another FormattedFile, this FormattedFile's dependent context will depend on otherContext. |
Thrown Exceptions
IOError |
The variants that accept the fileName parameter throw an exception of this type in case opening the file fails. |
---|
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
TExtensionVector getFileExtensions(file)
Static function that returns a list of allowed file format extension.
Parameters
file
|
The FormattedFile to query. |
---|
Returns
TExtensionVector |
A std::vector<std::string> with the allowed file extensions. |
---|
This is a shortcut to getFileExtensions.
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
bool guessFormat(file);
Guess the format of an open FormattedFile.
Parameters
file
|
The open FormattedFile for which the format is to be guessed. |
---|
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
bool isOpen(file);
Determines whether a FormattedFile is currently open.
Parameters
file
|
The FormattedFile to check. |
---|
Returns
bool |
true if file is currently open, false otherwise. |
---|
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
bool open(file, fileName, mode);
Open a FormattedFile.
Parameters
file
|
The FormattedFile to open. |
---|---|
fileName
|
The name of the file open. |
mode
|
The open mode: FileOpenMode. |
Returns
bool |
true in the case of success, false otherwise. |
---|
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
void setFormat(file, format);
Set the format of a FormattedFile.
Parameters
file
|
The FormattedFile to change. |
---|---|
format
|
The FileFormat to set. |
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.