]> git.donarmstrong.com Git - bamtools.git/blobdiff - src/utils/bamtools_utilities.h
Updated bamtools_utilities with #defines
[bamtools.git] / src / utils / bamtools_utilities.h
index 4f6928b6832fb9a3b2299626fed22b40e5611b56..f72897a9112876121da2054e154e0720763ea3a2 100644 (file)
@@ -3,7 +3,7 @@
 // Marth Lab, Department of Biology, Boston College
 // All rights reserved.
 // ---------------------------------------------------------------------------
-// Last modified: 2 June 2010
+// Last modified: 30 August 2010
 // ---------------------------------------------------------------------------
 // Provides general utilities used by BamTools sub-tools.
 // ***************************************************************************
 #ifndef BAMTOOLS_UTILITIES_H
 #define BAMTOOLS_UTILITIES_H
 
+#include <cassert>
+#include <stdexcept>
 #include <string>
 #include "BamAux.h"
 
+#define BAMTOOLS_ASSERT_UNREACHABLE assert( false )
+#define BAMTOOLS_ASSERT_MESSAGE( condition, message ) if (!( condition )) throw std::runtime_error( message );
+
 namespace BamTools {
 
 class BamReader;
@@ -21,15 +26,17 @@ class BamMultiReader;
 
 class Utilities {
   
-    public:                          
+    public: 
+        // check if a file exists
+        static bool FileExists(const std::string& fname);
+        
         // Parses a region string, uses reader to do validation (valid ID's, positions), stores in Region struct
         // Returns success (true/false)
         static bool ParseRegionString(const std::string& regionString, const BamReader& reader, BamRegion& region);
         // Same as above, but accepts a BamMultiReader
         static bool ParseRegionString(const std::string& regionString, const BamMultiReader& reader, BamRegion& region);
 
-        // check if a file exists
-        static bool FileExists(const std::string& fname); 
+         
 };
 
 } // namespace BamTools