]> git.donarmstrong.com Git - bamtools.git/blobdiff - src/api/internal/index/BamToolsIndex_p.h
Merge branch 'master' of https://github.com/pezmaster31/bamtools
[bamtools.git] / src / api / internal / index / BamToolsIndex_p.h
index 7c1550b6ea287f4baf9c59aa637ac7dfc65b0ca3..c1e1aa0dc1390ac4e569b4a6adfbece5feb3fa96 100644 (file)
@@ -2,7 +2,7 @@
 // BamToolsIndex.h (c) 2010 Derek Barnett
 // Marth Lab, Department of Biology, Boston College
 // ---------------------------------------------------------------------------
-// Last modified: 10 October 2011 (DB)
+// Last modified: 10 November 2011 (DB)
 // ---------------------------------------------------------------------------
 // Provides index operations for the BamTools index format (".bti")
 // ***************************************************************************
@@ -22,6 +22,7 @@
 
 #include "api/BamAux.h"
 #include "api/BamIndex.h"
+#include "api/IBamIODevice.h"
 #include <map>
 #include <string>
 #include <vector>
@@ -117,6 +118,7 @@ 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);
+        BamIndex::IndexType Type(void) const { return BamIndex::BAMTOOLS; }
     public:
         // returns format's file extension
         static const std::string Extension(void);
@@ -128,9 +130,9 @@ class BamToolsIndex : public BamIndex {
         void CheckMagicNumber(void);
         void CheckVersion(void);
         void CloseFile(void);
-        bool IsFileOpen(void) const;
-        void OpenFile(const std::string& filename, const char* mode);
-        void Seek(const int64_t& position, const int& origin);
+        bool IsDeviceOpen(void) const;
+        void OpenFile(const std::string& filename, IBamIODevice::OpenMode mode);
+        void Seek(const int64_t& position, const int origin);
         int64_t Tell(void) const;
 
         // index-creation methods
@@ -164,11 +166,11 @@ class BamToolsIndex : public BamIndex {
         Version m_outputVersion;
 
         struct RaiiWrapper {
-            FILE* IndexStream;
+            IBamIODevice* Device;
             RaiiWrapper(void);
             ~RaiiWrapper(void);
         };
-        RaiiWrapper Resources;
+        RaiiWrapper m_resources;
 
     // static constants
     private: