]> git.donarmstrong.com Git - bamtools.git/commitdiff
Removed index cache mode
authorderek <derekwbarnett@gmail.com>
Tue, 11 Oct 2011 04:04:54 +0000 (00:04 -0400)
committerderek <derekwbarnett@gmail.com>
Tue, 11 Oct 2011 04:04:54 +0000 (00:04 -0400)
15 files changed:
src/api/BamIndex.h
src/api/BamMultiReader.cpp
src/api/BamMultiReader.h
src/api/BamReader.cpp
src/api/BamReader.h
src/api/internal/BamMultiReader_p.cpp
src/api/internal/BamMultiReader_p.h
src/api/internal/BamRandomAccessController_p.cpp
src/api/internal/BamRandomAccessController_p.h
src/api/internal/BamReader_p.cpp
src/api/internal/BamReader_p.h
src/api/internal/BamStandardIndex_p.cpp
src/api/internal/BamStandardIndex_p.h
src/api/internal/BamToolsIndex_p.cpp
src/api/internal/BamToolsIndex_p.h

index 5e40d87eb517d4fbc8797e8f5d874eb520602f56..b0b1281b4c517c375113cbc6426cf5d7ddc9d480 100644 (file)
@@ -35,11 +35,6 @@ class API_EXPORT BamIndex {
 
     // enums
     public:
-        // specify index-caching behavior
-        enum IndexCacheMode { FullIndexCaching = 0 // store entire index file contents in memory
-                            , LimitedIndexCaching  // store only index data for current reference
-                            , NoIndexCaching       // do not store any index data between jumps
-                            };
 
         // list of supported BamIndex types
         enum IndexType { BAMTOOLS = 0
@@ -71,9 +66,6 @@ class API_EXPORT BamIndex {
         // loads existing data from file into memory
         virtual bool Load(const std::string& filename) =0;
 
-        // change the index caching behavior
-        virtual void SetCacheMode(const BamIndex::IndexCacheMode& mode) =0;
-
     //! \cond
 
     // internal methods
index 6efeff6047fb8ac2d6243f1c8eeef4c2e4580aba..ef38469651c292e49fdbfec9317cc903791c24f3 100644 (file)
@@ -321,19 +321,6 @@ bool BamMultiReader::Rewind(void) {
     return d->Rewind();
 }
 
-/*! \fn void BamMultiReader::SetIndexCacheMode(const BamIndex::IndexCacheMode& mode)
-    \brief Changes the caching behavior of the index data.
-
-    Default mode is BamIndex::LimitedIndexCaching.
-
-    \param[in] mode desired cache mode for index, see BamIndex::IndexCacheMode for
-                    description of the available cache modes
-    \sa HasIndex(), BamReader::SetIndexCacheMode()
-*/
-void BamMultiReader::SetIndexCacheMode(const BamIndex::IndexCacheMode& mode) {
-    d->SetIndexCacheMode(mode);
-}
-
 /*! \fn bool BamMultiReader::SetRegion(const BamRegion& region)
     \brief Sets a target region of interest
 
index 76d0810e2f6fa411b5cf00e80426304292c03d69..ea068d0c0ad58a9736fde8b4abb34de6632fcefe 100644 (file)
@@ -97,8 +97,6 @@ class API_EXPORT BamMultiReader {
         bool LocateIndexes(const BamIndex::IndexType& preferredType = BamIndex::STANDARD);
         // opens index files for current BAM files.
         bool OpenIndexes(const std::vector<std::string>& indexFilenames);
-        // changes the caching behavior of the index data
-        void SetIndexCacheMode(const BamIndex::IndexCacheMode& mode);
 
         // ----------------------
         // error handling
index 6e4a10f80ece0b7b6cfd0d55c125f6dd509bf012..6080b3656198d29fa22f6d6cb82d64f102ae5edf 100644 (file)
@@ -310,19 +310,6 @@ void BamReader::SetIndex(BamIndex* index) {
     d->SetIndex(index);
 }
 
-/*! \fn void BamReader::SetIndexCacheMode(const BamIndex::IndexCacheMode& mode)
-    \brief Changes the caching behavior of the index data.
-
-    Default mode is BamIndex::LimitedIndexCaching.
-
-    \param[in] mode desired cache mode for index, see BamIndex::IndexCacheMode for
-                    description of the available cache modes
-    \sa HasIndex()
-*/
-void BamReader::SetIndexCacheMode(const BamIndex::IndexCacheMode& mode) {
-    d->SetIndexCacheMode(mode);
-}
-
 /*! \fn bool BamReader::SetRegion(const BamRegion& region)
     \brief Sets a target region of interest
 
index 30c4d5f4de1fa1c415738c54f914f9b7f5dd2314..fb9064d9994d08a4c2afe177b2ca205c1841da4c 100644 (file)
@@ -99,8 +99,6 @@ class API_EXPORT BamReader {
         bool OpenIndex(const std::string& indexFilename);\r
         // sets a custom BamIndex on this reader\r
         void SetIndex(BamIndex* index);\r
-        // changes the caching behavior of the index data\r
-        void SetIndexCacheMode(const BamIndex::IndexCacheMode& mode);\r
 \r
         // ----------------------\r
         // error handling\r
index 076f1bba9ac7e5a9e70d79a8e488f87e8f4fe2c2..ecf2839ad07074aee6a608491e4c3e2a15454667 100644 (file)
@@ -623,22 +623,6 @@ void BamMultiReaderPrivate::SetErrorString(const string& where, const string& wh
     m_errorString = where + SEPARATOR + what;
 }
 
-// sets the index caching mode on the readers
-void BamMultiReaderPrivate::SetIndexCacheMode(const BamIndex::IndexCacheMode mode) {
-
-    // iterate over readers
-    vector<MergeItem>::iterator readerIter = m_readers.begin();
-    vector<MergeItem>::iterator readerEnd  = m_readers.end();
-    for ( ; readerIter != readerEnd; ++readerIter ) {
-        MergeItem& item = (*readerIter);
-        BamReader* reader = item.Reader;
-        if ( reader == 0 ) continue;
-
-        // set reader's index cache mode
-        reader->SetIndexCacheMode(mode);
-    }
-}
-
 bool BamMultiReaderPrivate::SetRegion(const BamRegion& region) {
 
     // NB: While it may make sense to track readers in which we can
index 01d12304f57c5ef6d113e07fc7ca7242a5c87e4f..9d001f5be0dfd401651e49282960966a49db59b6 100644 (file)
@@ -70,7 +70,6 @@ class BamMultiReaderPrivate {
         bool HasIndexes(void) const;
         bool LocateIndexes(const BamIndex::IndexType& preferredType = BamIndex::STANDARD);
         bool OpenIndexes(const std::vector<std::string>& indexFilenames);
-        void SetIndexCacheMode(const BamIndex::IndexCacheMode mode);
 
         // error handling
         std::string GetErrorString(void) const;
index 1e44b7daef47ccc52e96df28c6e1471b7e9cf270..c223ed762d9e5cb23b322fb6f90c4b7a3810e499 100644 (file)
@@ -21,7 +21,6 @@ using namespace std;
 
 BamRandomAccessController::BamRandomAccessController(void)
     : m_index(0)
-    , m_indexCacheMode(BamIndex::LimitedIndexCaching)
     , m_hasAlignmentsInRegion(true)
 { }
 
@@ -174,11 +173,8 @@ bool BamRandomAccessController::CreateIndex(BamReaderPrivate* reader,
         return false;
     }
 
-    // save new index
+    // save new index & return success
     SetIndex(newIndex);
-
-    // set new index's cache mode & return success
-    newIndex->SetCacheMode(m_indexCacheMode);
     return true;
 }
 
@@ -226,9 +222,6 @@ bool BamRandomAccessController::OpenIndex(const string& indexFilename, BamReader
         return false;
     }
 
-    // set cache mode
-    index->SetCacheMode(m_indexCacheMode);
-
     // attempt to load data from index file
     if ( !index->Load(indexFilename) ) {
         const string indexError = index->GetErrorString();
@@ -257,12 +250,6 @@ void BamRandomAccessController::SetIndex(BamIndex* index) {
     m_index = index;
 }
 
-void BamRandomAccessController::SetIndexCacheMode(const BamIndex::IndexCacheMode& mode) {
-    m_indexCacheMode = mode;
-    if ( m_index )
-        m_index->SetCacheMode(mode);
-}
-
 bool BamRandomAccessController::SetRegion(const BamRegion& region, const int& referenceCount) {
 
     // store region
index 43b6fb038c18c196e78b79928e3f4de35d65425b..9262a6123eed38099e4a7235716280dd34543db9 100644 (file)
@@ -55,7 +55,6 @@ class BamRandomAccessController {
         bool LocateIndex(BamReaderPrivate* reader, const BamIndex::IndexType& preferredType);
         bool OpenIndex(const std::string& indexFilename, BamReaderPrivate* reader);
         void SetIndex(BamIndex* index);
-        void SetIndexCacheMode(const BamIndex::IndexCacheMode& mode);
 
         // region methods
         void ClearRegion(void);
@@ -80,7 +79,6 @@ class BamRandomAccessController {
 
         // index data
         BamIndex* m_index;  // owns the index, not a copy - responsible for deleting
-        BamIndex::IndexCacheMode m_indexCacheMode;
 
         // region data
         BamRegion m_region;
index 11cba33ce177fabbc382738f99e6dcfb9b309554..dc6792fe8c210b685557809f06f9a993d8f41ebc 100644 (file)
@@ -447,11 +447,6 @@ void BamReaderPrivate::SetIndex(BamIndex* index) {
     m_randomAccessController.SetIndex(index);
 }
 
-// change the index caching behavior
-void BamReaderPrivate::SetIndexCacheMode(const BamIndex::IndexCacheMode& mode) {
-    m_randomAccessController.SetIndexCacheMode(mode);
-}
-
 // sets current region & attempts to jump to it
 // returns success/failure
 bool BamReaderPrivate::SetRegion(const BamRegion& region) {
index 2f670d59d94d829aead92868f0ed8c7a13e2cec3..f9282731d24fd66224ffc78d8f378b4a537001ec 100644 (file)
@@ -67,7 +67,6 @@ class BamReaderPrivate {
         bool LocateIndex(const BamIndex::IndexType& preferredType);
         bool OpenIndex(const std::string& indexFilename);
         void SetIndex(BamIndex* index);
-        void SetIndexCacheMode(const BamIndex::IndexCacheMode& mode);
 
         // error handling
         std::string GetErrorString(void) const;
index c492899a20167d4924be71ff25d18c0b55fc0a18..8b23f749b43ca4af6203afa857ea58ea009ed069 100644 (file)
@@ -62,7 +62,6 @@ BamStandardIndex::RaiiWrapper::~RaiiWrapper(void) {
 // ctor
 BamStandardIndex::BamStandardIndex(Internal::BamReaderPrivate* reader)
     : BamIndex(reader)
-    , m_cacheMode(BamIndex::LimitedIndexCaching)
     , m_bufferLength(0)
 {
      m_isBigEndian = BamTools::SystemIsBigEndian();
@@ -762,12 +761,6 @@ void BamStandardIndex::Seek(const int64_t& position, const int& origin) {
         throw BamException("BamStandardIndex::Seek", "could not seek in BAI file");
 }
 
-// change the index caching behavior
-void BamStandardIndex::SetCacheMode(const BamIndex::IndexCacheMode& mode) {
-    m_cacheMode = mode;
-    // do nothing else here ? cache mode will be ignored from now on, most likely
-}
-
 void BamStandardIndex::SkipBins(const int& numBins) {
     uint32_t binId;
     int32_t numAlignmentChunks;
index cb907ac08a9f0cb623a452f87637515175274537..03e0042405176fc13a320ee0d06a5bba7f0ada9c 100644 (file)
@@ -122,8 +122,6 @@ class BamStandardIndex : public BamIndex {
         bool Jump(const BamTools::BamRegion& region, bool* hasAlignmentsInRegion);
         // loads existing data from file into memory
         bool Load(const std::string& filename);
-        // change the index caching behavior
-        void SetCacheMode(const BamIndex::IndexCacheMode& mode);
     public:
         // returns format's file extension
         static const std::string Extension(void);
@@ -198,7 +196,6 @@ class BamStandardIndex : public BamIndex {
     // data members
     private:
         bool m_isBigEndian;
-        BamIndex::IndexCacheMode m_cacheMode;
         BaiFileSummary m_indexFileSummary;
 
         // our input buffer
index 567b5514428d515348282f1bddfbfed14a55f7a9..cdf3d10a597fe1697f504f80015f92c481a743b5 100644 (file)
@@ -53,7 +53,6 @@ BamToolsIndex::RaiiWrapper::~RaiiWrapper(void) {
 // ctor
 BamToolsIndex::BamToolsIndex(Internal::BamReaderPrivate* reader)
     : BamIndex(reader)
-    , m_cacheMode(BamIndex::LimitedIndexCaching)
     , m_blockSize(BamToolsIndex::DEFAULT_BLOCK_LENGTH)
     , m_inputVersion(0)
     , m_outputVersion(BTI_2_0) // latest version - used for writing new index files
@@ -538,12 +537,6 @@ void BamToolsIndex::Seek(const int64_t& position, const int& origin) {
         throw BamException("BamToolsIndex::Seek", "could not seek in BAI file");
 }
 
-// change the index caching behavior
-void BamToolsIndex::SetCacheMode(const BamIndex::IndexCacheMode& mode) {
-    m_cacheMode = mode;
-    // do nothing else here ? cache mode will be ignored from now on, most likely
-}
-
 void BamToolsIndex::SkipBlocks(const int& numBlocks) {
     Seek( numBlocks*BamToolsIndex::SIZEOF_BLOCK, SEEK_CUR );
 }
index 902be794295ad26bdb6fd35c8a52f5f1a69b974d..7c1550b6ea287f4baf9c59aa637ac7dfc65b0ca3 100644 (file)
@@ -117,8 +117,6 @@ class BamToolsIndex : public BamIndex {
         bool Jump(const BamTools::BamRegion& region, bool* hasAlignmentsInRegion);
         // loads existing data from file into memory
         bool Load(const std::string& filename);
-        // change the index caching behavior
-        void SetCacheMode(const BamIndex::IndexCacheMode& mode);
     public:
         // returns format's file extension
         static const std::string Extension(void);
@@ -160,7 +158,6 @@ class BamToolsIndex : public BamIndex {
     // data members
     private:
         bool  m_isBigEndian;
-        BamIndex::IndexCacheMode m_cacheMode;
         BtiFileSummary m_indexFileSummary;
         uint32_t m_blockSize;
         int32_t m_inputVersion; // Version is serialized as int