]> git.donarmstrong.com Git - bamtools.git/blobdiff - src/api/BamIndex.cpp
Fixed NoIndexCaching behavior
[bamtools.git] / src / api / BamIndex.cpp
index 222d96d8d03167cab8a1920f574435fd5a85cff4..e47fd289dac22e0d28dfd76319934c6649d0d6f3 100644 (file)
@@ -635,6 +635,12 @@ bool BamStandardIndex::BamStandardIndexPrivate::GetOffsets(const BamRegion& regi
     
     // set flag & return success
     *hasAlignmentsInRegion = (offsets.size() != 0 );
+
+    // if cache mode set to none, dump the data we just loaded
+    if (m_parent->m_cacheMode == BamIndex::NoIndexCaching )
+        ClearReferenceOffsets(region.LeftRefID);
+
+    // return succes
     return true;
 }
 
@@ -1634,6 +1640,12 @@ bool BamToolsIndex::BamToolsIndexPrivate::GetOffset(const BamRegion& region, int
   
     // set flag based on whether an index entry was found for this region
     *hasAlignmentsInRegion = ( indexIter != indexEnd );
+
+    // if cache mode set to none, dump the data we just loaded
+    if (m_parent->m_cacheMode == BamIndex::NoIndexCaching )
+        ClearReferenceOffsets(region.LeftRefID);
+
+    // return success
     return true; 
 }