From 19077d59154eeb244af96b1fd9658e535c24c1be Mon Sep 17 00:00:00 2001 From: derek Date: Tue, 11 Oct 2011 00:04:54 -0400 Subject: [PATCH] Removed index cache mode --- src/api/BamIndex.h | 8 -------- src/api/BamMultiReader.cpp | 13 ------------- src/api/BamMultiReader.h | 2 -- src/api/BamReader.cpp | 13 ------------- src/api/BamReader.h | 2 -- src/api/internal/BamMultiReader_p.cpp | 16 ---------------- src/api/internal/BamMultiReader_p.h | 1 - src/api/internal/BamRandomAccessController_p.cpp | 15 +-------------- src/api/internal/BamRandomAccessController_p.h | 2 -- src/api/internal/BamReader_p.cpp | 5 ----- src/api/internal/BamReader_p.h | 1 - src/api/internal/BamStandardIndex_p.cpp | 7 ------- src/api/internal/BamStandardIndex_p.h | 3 --- src/api/internal/BamToolsIndex_p.cpp | 7 ------- src/api/internal/BamToolsIndex_p.h | 3 --- 15 files changed, 1 insertion(+), 97 deletions(-) diff --git a/src/api/BamIndex.h b/src/api/BamIndex.h index 5e40d87..b0b1281 100644 --- a/src/api/BamIndex.h +++ b/src/api/BamIndex.h @@ -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 diff --git a/src/api/BamMultiReader.cpp b/src/api/BamMultiReader.cpp index 6efeff6..ef38469 100644 --- a/src/api/BamMultiReader.cpp +++ b/src/api/BamMultiReader.cpp @@ -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 diff --git a/src/api/BamMultiReader.h b/src/api/BamMultiReader.h index 76d0810..ea068d0 100644 --- a/src/api/BamMultiReader.h +++ b/src/api/BamMultiReader.h @@ -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& indexFilenames); - // changes the caching behavior of the index data - void SetIndexCacheMode(const BamIndex::IndexCacheMode& mode); // ---------------------- // error handling diff --git a/src/api/BamReader.cpp b/src/api/BamReader.cpp index 6e4a10f..6080b36 100644 --- a/src/api/BamReader.cpp +++ b/src/api/BamReader.cpp @@ -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 diff --git a/src/api/BamReader.h b/src/api/BamReader.h index 30c4d5f..fb9064d 100644 --- a/src/api/BamReader.h +++ b/src/api/BamReader.h @@ -99,8 +99,6 @@ class API_EXPORT BamReader { bool OpenIndex(const std::string& indexFilename); // sets a custom BamIndex on this reader void SetIndex(BamIndex* index); - // changes the caching behavior of the index data - void SetIndexCacheMode(const BamIndex::IndexCacheMode& mode); // ---------------------- // error handling diff --git a/src/api/internal/BamMultiReader_p.cpp b/src/api/internal/BamMultiReader_p.cpp index 076f1bb..ecf2839 100644 --- a/src/api/internal/BamMultiReader_p.cpp +++ b/src/api/internal/BamMultiReader_p.cpp @@ -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::iterator readerIter = m_readers.begin(); - vector::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 diff --git a/src/api/internal/BamMultiReader_p.h b/src/api/internal/BamMultiReader_p.h index 01d1230..9d001f5 100644 --- a/src/api/internal/BamMultiReader_p.h +++ b/src/api/internal/BamMultiReader_p.h @@ -70,7 +70,6 @@ class BamMultiReaderPrivate { bool HasIndexes(void) const; bool LocateIndexes(const BamIndex::IndexType& preferredType = BamIndex::STANDARD); bool OpenIndexes(const std::vector& indexFilenames); - void SetIndexCacheMode(const BamIndex::IndexCacheMode mode); // error handling std::string GetErrorString(void) const; diff --git a/src/api/internal/BamRandomAccessController_p.cpp b/src/api/internal/BamRandomAccessController_p.cpp index 1e44b7d..c223ed7 100644 --- a/src/api/internal/BamRandomAccessController_p.cpp +++ b/src/api/internal/BamRandomAccessController_p.cpp @@ -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 diff --git a/src/api/internal/BamRandomAccessController_p.h b/src/api/internal/BamRandomAccessController_p.h index 43b6fb0..9262a61 100644 --- a/src/api/internal/BamRandomAccessController_p.h +++ b/src/api/internal/BamRandomAccessController_p.h @@ -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; diff --git a/src/api/internal/BamReader_p.cpp b/src/api/internal/BamReader_p.cpp index 11cba33..dc6792f 100644 --- a/src/api/internal/BamReader_p.cpp +++ b/src/api/internal/BamReader_p.cpp @@ -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) { diff --git a/src/api/internal/BamReader_p.h b/src/api/internal/BamReader_p.h index 2f670d5..f928273 100644 --- a/src/api/internal/BamReader_p.h +++ b/src/api/internal/BamReader_p.h @@ -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; diff --git a/src/api/internal/BamStandardIndex_p.cpp b/src/api/internal/BamStandardIndex_p.cpp index c492899..8b23f74 100644 --- a/src/api/internal/BamStandardIndex_p.cpp +++ b/src/api/internal/BamStandardIndex_p.cpp @@ -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; diff --git a/src/api/internal/BamStandardIndex_p.h b/src/api/internal/BamStandardIndex_p.h index cb907ac..03e0042 100644 --- a/src/api/internal/BamStandardIndex_p.h +++ b/src/api/internal/BamStandardIndex_p.h @@ -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 diff --git a/src/api/internal/BamToolsIndex_p.cpp b/src/api/internal/BamToolsIndex_p.cpp index 567b551..cdf3d10 100644 --- a/src/api/internal/BamToolsIndex_p.cpp +++ b/src/api/internal/BamToolsIndex_p.cpp @@ -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 ); } diff --git a/src/api/internal/BamToolsIndex_p.h b/src/api/internal/BamToolsIndex_p.h index 902be79..7c1550b 100644 --- a/src/api/internal/BamToolsIndex_p.h +++ b/src/api/internal/BamToolsIndex_p.h @@ -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 -- 2.39.2