]> git.donarmstrong.com Git - bamtools.git/blobdiff - src/api/BamAux.h
Removed STDERR pollution by API
[bamtools.git] / src / api / BamAux.h
index 4c5a99aca66eb76d3e0646f152ff25bf402cbdae..14e65476b4c1f69d02bf02e417ededdcc5e02985 100644 (file)
@@ -2,7 +2,7 @@
 // BamAux.h (c) 2009 Derek Barnett, Michael Str�mberg\r
 // Marth Lab, Department of Biology, Boston College\r
 // ---------------------------------------------------------------------------\r
-// Last modified: 4 March 2011 (DB)\r
+// Last modified: 7 October 2011 (DB)\r
 // ---------------------------------------------------------------------------\r
 // Provides data structures & utility methods that are used throughout the API.\r
 // ***************************************************************************\r
@@ -451,6 +451,19 @@ API_EXPORT inline unsigned short UnpackUnsignedShort(char* buffer) {
     return UnpackUnsignedShort( (const char*)buffer );\r
 }\r
 \r
+// ----------------------------------------------------------------\r
+// 'internal' helper structs\r
+\r
+struct RaiiBuffer {\r
+    RaiiBuffer(const unsigned int n)\r
+        : Buffer( new char[n]() )\r
+    { }\r
+    ~RaiiBuffer(void) {\r
+        delete[] Buffer;\r
+    }\r
+    char* Buffer;\r
+};\r
+\r
 } // namespace BamTools\r
 \r
 #endif // BAMAUX_H\r