]> git.donarmstrong.com Git - bamtools.git/blobdiff - src/api/BamWriter.h
Cleaned up intra-API includes & moved version numbers to 2.0.0
[bamtools.git] / src / api / BamWriter.h
index 910f9be6240fa40a0fe9ecefe2da52ad564cdb6c..68257ee4a8a3e3145090154cd93fb601a1ca2666 100644 (file)
@@ -1,12 +1,8 @@
 // ***************************************************************************\r
 // BamWriter.h (c) 2009 Michael Str�mberg, Derek Barnett\r
 // Marth Lab, Department of Biology, Boston College\r
-// All rights reserved.\r
 // ---------------------------------------------------------------------------\r
-// Last modified: 19 November 2010 (DB)\r
-// ---------------------------------------------------------------------------\r
-// Uses BGZF routines were adapted from the bgzf.c code developed at the Broad\r
-// Institute.\r
+// Last modified: 10 October 2011 (DB)\r
 // ---------------------------------------------------------------------------\r
 // Provides the basic functionality for producing BAM files\r
 // ***************************************************************************\r
 #ifndef BAMWRITER_H\r
 #define BAMWRITER_H\r
 \r
-#include <api/api_global.h>\r
-#include <api/BamAlignment.h>\r
+#include "api/api_global.h"\r
+#include "api/BamAux.h"\r
 #include <string>\r
 \r
 namespace BamTools {\r
 \r
+class BamAlignment;\r
+class SamHeader;\r
+\r
+//! \cond\r
+namespace Internal {\r
+    class BamWriterPrivate;\r
+} // namespace Internal\r
+//! \endcond\r
+\r
 class API_EXPORT BamWriter {\r
 \r
-    // constructor/destructor\r
+    // enums\r
+    public:\r
+        enum CompressionMode { Compressed = 0\r
+                             , Uncompressed\r
+                             };\r
+\r
+    // ctor & dtor\r
     public:\r
         BamWriter(void);\r
         ~BamWriter(void);\r
 \r
     // public interface\r
     public:\r
-        // closes the alignment archive\r
+        //  closes the current BAM file\r
         void Close(void);\r
-        // opens the alignment archive\r
+        // returns a human-readable description of the last error that occurred\r
+        std::string GetErrorString(void) const;\r
+        // returns true if BAM file is open for writing\r
+        bool IsOpen(void) const;\r
+        // opens a BAM file for writing\r
         bool Open(const std::string& filename, \r
-                  const std::string& samHeader, \r
-                  const BamTools::RefVector& referenceSequences, \r
-                  bool writeUncompressed = false);\r
+                  const std::string& samHeaderText,\r
+                  const RefVector& referenceSequences);\r
+        // opens a BAM file for writing\r
+        bool Open(const std::string& filename,\r
+                  const SamHeader& samHeader,\r
+                  const RefVector& referenceSequences);\r
         // saves the alignment to the alignment archive\r
-        void SaveAlignment(const BamTools::BamAlignment& al);\r
+        bool SaveAlignment(const BamAlignment& alignment);\r
+        // sets the output compression mode\r
+        void SetCompressionMode(const BamWriter::CompressionMode& compressionMode);\r
 \r
     // private implementation\r
     private:\r
-        struct BamWriterPrivate;\r
-        BamWriterPrivate* d;\r
+        Internal::BamWriterPrivate* d;\r
 };\r
 \r
 } // namespace BamTools\r