#include <api/BamConstants.h>
#include <api/BamReader.h>
+#include <api/IBamIODevice.h>
+#include <api/internal/BamDeviceFactory_p.h>
#include <api/internal/BamException_p.h>
#include <api/internal/BamHeader_p.h>
#include <api/internal/BamRandomAccessController_p.h>
// useful for operations requiring ONLY positional or other alignment-related information
bool BamReaderPrivate::GetNextAlignmentCore(BamAlignment& alignment) {
+ // skip if stream not opened
+ if ( !m_stream.IsOpen() )
+ return false;
+
try {
// skip if region is set but has no alignments
}
bool BamReaderPrivate::IsOpen(void) const {
- return m_stream.IsOpen;
+ return m_stream.IsOpen();
}
// load BAM header data
// swap core endian-ness if necessary
if ( m_isBigEndian ) {
- for ( int i = 0; i < Constants::BAM_CORE_SIZE; i+=sizeof(uint32_t) )
+ for ( unsigned int i = 0; i < Constants::BAM_CORE_SIZE; i+=sizeof(uint32_t) )
BamTools::SwapEndian_32p(&x[i]);
}
// opens BAM file (and index)
bool BamReaderPrivate::Open(const string& filename) {
- bool result;
-
try {
// make sure we're starting with fresh state
m_filename = filename;
m_alignmentsBeginOffset = m_stream.Tell();
- // set flag
- result = true;
+ // return success
+ return true;
} catch ( BamException& e ) {
const string error = e.what();
SetErrorString("BamReader::Open", message);
return false;
}
-
- // return success/failure
- return result;
}
bool BamReaderPrivate::OpenIndex(const std::string& indexFilename) {