]> git.donarmstrong.com Git - bamtools.git/blobdiff - src/api/internal/BamReader_p.h
Updated CMakeLists.txt files
[bamtools.git] / src / api / internal / BamReader_p.h
index 7dda67f14569a5412a0eff3df9c0867fa9515902..f9282731d24fd66224ffc78d8f378b4a537001ec 100644 (file)
@@ -1,9 +1,8 @@
 // ***************************************************************************
 // BamReader_p.h (c) 2010 Derek Barnett
 // Marth Lab, Department of Biology, Boston College
-// All rights reserved.
 // ---------------------------------------------------------------------------
-// Last modified: 24 February 2011 (DB)
+// Last modified: 10 October 2011 (DB)
 // ---------------------------------------------------------------------------
 // Provides the basic functionality for reading BAM files
 // ***************************************************************************
 //
 // We mean it.
 
-#include <api/BamAlignment.h>
-#include <api/BamIndex.h>
-#include <api/BamReader.h>
-#include <api/SamHeader.h>
-#include <api/internal/BamHeader_p.h>
-#include <api/internal/BamRandomAccessController_p.h>
-#include <api/internal/BgzfStream_p.h>
+#include "api/BamAlignment.h"
+#include "api/BamIndex.h"
+#include "api/BamReader.h"
+#include "api/SamHeader.h"
+#include "api/internal/BamHeader_p.h"
+#include "api/internal/BamRandomAccessController_p.h"
+#include "api/internal/BgzfStream_p.h"
 #include <string>
 
 namespace BamTools {
@@ -44,7 +43,7 @@ class BamReaderPrivate {
     public:
 
         // file operations
-        void Close(void);
+        bool Close(void);
         const std::string Filename(void) const;
         bool IsOpen(void) const;
         bool Open(const std::string& filename);
@@ -68,21 +67,27 @@ class BamReaderPrivate {
         bool LocateIndex(const BamIndex::IndexType& preferredType);
         bool OpenIndex(const std::string& indexFilename);
         void SetIndex(BamIndex* index);
-        void SetIndexCacheMode(const BamIndex::IndexCacheMode& mode);
 
-    // BamReaderPrivate interface
-    public:
-        BgzfStream* Stream(void);
+        // error handling
+        std::string GetErrorString(void) const;
+        void SetErrorString(const std::string& where, const std::string& what);
 
-    // 'internal' methods
+    // internal methods, but available as a BamReaderPrivate 'interface'
+    //
+    // these methods should only be used by BamTools::Internal classes
+    // (currently only used by the BamIndex subclasses)
     public:
         // retrieves header text from BAM file
-        bool LoadHeaderData(void);
+        void LoadHeaderData(void);
         // retrieves BAM alignment under file pointer
         // (does no overlap checking or character data parsing)
         bool LoadNextAlignment(BamAlignment& alignment);
         // builds reference data structure from BAM file
         bool LoadReferenceData(void);
+        // seek reader to file position
+        bool Seek(const int64_t& position);
+        // return reader's file position
+        int64_t Tell(void) const;
 
     // data members
     public:
@@ -102,6 +107,9 @@ class BamReaderPrivate {
         BamHeader m_header;
         BamRandomAccessController m_randomAccessController;
         BgzfStream m_stream;
+
+        // error handling
+        std::string m_errorString;
 };
 
 } // namespace Internal