|
libStatGen Software 1
|
This class allows a user to easily read/write a GLF file. More...
#include <GlfFile.h>

Public Types | |
| enum | OpenType { READ , WRITE } |
| Enum for indicating whether to open the file for read or write. More... | |
Public Member Functions | |
| GlfFile () | |
| Default Constructor. | |
| GlfFile (const char *filename, OpenType mode=READ) | |
| Constructor that opens the specified file based on the specified mode (READ/WRITE). | |
| virtual | ~GlfFile () |
| Closes the file if there is one open, adding an end marker record if there is a previous section and one has not already been written. | |
| bool | openForRead (const char *filename) |
| Open a glf file for reading with the specified filename. | |
| bool | openForRead (const char *filename, GlfHeader &header) |
| Open a glf file for reading with the specified filename and read the header into the specified header. | |
| bool | openForWrite (const char *filename, bool compressed=true) |
| Open a glf file for writing with the specified filename. | |
| void | close () |
| Close the file if there is one open, adding an end marker record if there is a previous section and one has not already been written. | |
| bool | isEOF () |
| Returns whether or not the end of the file has been reached. | |
| bool | readHeader (GlfHeader &header) |
| Reads the header section from the file and stores it in the passed in header. | |
| bool | writeHeader (GlfHeader &header) |
| Writes the specified header into the file. | |
| bool | getNextRefSection (GlfRefSection &refSection) |
| Gets the next reference section from the file & stores it in the passed in section, consuming records until a new section is found. | |
| bool | writeRefSection (const GlfRefSection &refSection) |
| Write the reference section to the file, adding an end marker record if there is a previous section and one has not already been written. | |
| bool | getNextRecord (GlfRecord &record) |
| Gets the nextrecord from the file & stores it in the passed in record. | |
| bool | writeRecord (const GlfRecord &record) |
| Writes the specified record into the file. | |
| uint32_t | getCurrentRecordCount () |
| Return the number of records that have been read/written so far. | |
| GlfStatus::Status | getFailure () |
| Get the Status of the last call that sets status. | |
| GlfStatus::Status | getStatus () |
| Get the Status of the last call that sets status. | |
| const char * | getStatusMessage () |
| Get the Status of the last call that sets status. | |
| enum GlfFile::OpenType |
| GlfFile::GlfFile | ( | ) |
Default Constructor.
Definition at line 23 of file GlfFile.cpp.
Constructor that opens the specified file based on the specified mode (READ/WRITE).
Default is READ.
| filename | name of the file to open. |
| mode | mode to use for opening the file (defaults to READ). |
Definition at line 33 of file GlfFile.cpp.
References getStatusMessage(), openForRead(), openForWrite(), and READ.
|
virtual |
Closes the file if there is one open, adding an end marker record if there is a previous section and one has not already been written.
Definition at line 59 of file GlfFile.cpp.
| void GlfFile::close | ( | ) |
Close the file if there is one open, adding an end marker record if there is a previous section and one has not already been written.
Definition at line 142 of file GlfFile.cpp.
| uint32_t GlfFile::getCurrentRecordCount | ( | ) |
Return the number of records that have been read/written so far.
Definition at line 483 of file GlfFile.cpp.
|
inline |
Get the Status of the last call that sets status.
To remain backwards compatable - will be removed later.
Definition at line 121 of file GlfFile.h.
References getStatus().
| bool GlfFile::getNextRecord | ( | GlfRecord & | record | ) |
Gets the nextrecord from the file & stores it in the passed in record.
| record | object to populate with the file's next record. |
Definition at line 368 of file GlfFile.cpp.
References GlfStatus::FAIL_ORDER, GlfRecord::getRecordType(), isEOF(), GlfRecord::read(), GlfStatus::SUCCESS, and GlfStatus::UNKNOWN.
Referenced by getNextRefSection().
| bool GlfFile::getNextRefSection | ( | GlfRefSection & | refSection | ) |
Gets the next reference section from the file & stores it in the passed in section, consuming records until a new section is found.
| refSection | object to populate with the file's next reference section. |
Definition at line 240 of file GlfFile.cpp.
References GlfStatus::FAIL_IO, GlfStatus::FAIL_ORDER, getNextRecord(), isEOF(), GlfRefSection::read(), GlfStatus::SUCCESS, and GlfStatus::UNKNOWN.
|
inline |
Get the Status of the last call that sets status.
Definition at line 128 of file GlfFile.h.
Referenced by getFailure().
|
inline |
Get the Status of the last call that sets status.
Definition at line 135 of file GlfFile.h.
Referenced by GlfFile(), GlfFileReader::GlfFileReader(), and GlfFileWriter::GlfFileWriter().
| bool GlfFile::isEOF | ( | ) |
Returns whether or not the end of the file has been reached.
Definition at line 152 of file GlfFile.cpp.
References ifeof().
Referenced by getNextRecord(), and getNextRefSection().
| bool GlfFile::openForRead | ( | const char * | filename | ) |
Open a glf file for reading with the specified filename.
| filename | glf file to open for reading. |
Definition at line 66 of file GlfFile.cpp.
References GlfStatus::FAIL_IO, ifopen(), and GlfStatus::SUCCESS.
Referenced by GlfFile(), GlfFileReader::GlfFileReader(), and openForRead().
| bool GlfFile::openForRead | ( | const char * | filename, |
| GlfHeader & | header ) |
Open a glf file for reading with the specified filename and read the header into the specified header.
| filename | glf file to open for reading. |
| header | header object to populate with the file's glf header. |
Definition at line 92 of file GlfFile.cpp.
References openForRead(), and readHeader().
| bool GlfFile::openForWrite | ( | const char * | filename, |
| bool | compressed = true ) |
Open a glf file for writing with the specified filename.
| filename | glf file to open for writing. |
| compressed | whether or not to compress the file, defaults to true |
Definition at line 109 of file GlfFile.cpp.
References InputFile::BGZF, GlfStatus::FAIL_IO, ifopen(), GlfStatus::SUCCESS, and InputFile::UNCOMPRESSED.
Referenced by GlfFile(), and GlfFileWriter::GlfFileWriter().
| bool GlfFile::readHeader | ( | GlfHeader & | header | ) |
Reads the header section from the file and stores it in the passed in header.
| header | header object to populate with the file's glf header. |
Definition at line 165 of file GlfFile.cpp.
References GlfStatus::FAIL_ORDER, GlfHeader::read(), GlfStatus::SUCCESS, and GlfStatus::UNKNOWN.
Referenced by openForRead().
| bool GlfFile::writeHeader | ( | GlfHeader & | header | ) |
Writes the specified header into the file.
| header | header object to write into the file. |
Definition at line 200 of file GlfFile.cpp.
References GlfStatus::FAIL_ORDER, GlfStatus::SUCCESS, GlfStatus::UNKNOWN, and GlfHeader::write().
| bool GlfFile::writeRecord | ( | const GlfRecord & | record | ) |
Writes the specified record into the file.
| record | record to write to the file. |
Definition at line 429 of file GlfFile.cpp.
References GlfStatus::FAIL_ORDER, GlfRecord::getRecordType(), GlfStatus::SUCCESS, GlfStatus::UNKNOWN, and GlfRecord::write().
Referenced by writeRefSection().
| bool GlfFile::writeRefSection | ( | const GlfRefSection & | refSection | ) |
Write the reference section to the file, adding an end marker record if there is a previous section and one has not already been written.
| refSection | reference section to write to the file. |
Definition at line 308 of file GlfFile.cpp.
References GlfStatus::FAIL_IO, GlfStatus::FAIL_ORDER, GlfStatus::SUCCESS, GlfStatus::UNKNOWN, GlfRefSection::write(), and writeRecord().