]> git.donarmstrong.com Git - bamtools.git/blobdiff - src/api/internal/BamReader_p.h
Cleaned up intra-API includes & moved version numbers to 2.0.0
[bamtools.git] / src / api / internal / BamReader_p.h
index 7dda67f14569a5412a0eff3df9c0867fa9515902..2f670d59d94d829aead92868f0ed8c7a13e2cec3 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);
@@ -70,19 +69,26 @@ class BamReaderPrivate {
         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 +108,9 @@ class BamReaderPrivate {
         BamHeader m_header;
         BamRandomAccessController m_randomAccessController;
         BgzfStream m_stream;
+
+        // error handling
+        std::string m_errorString;
 };
 
 } // namespace Internal