1 // ***************************************************************************
2 // bamtools_global.h (c) 2010 Derek Barnett
3 // Marth Lab, Department of Biology, Boston College
4 // ---------------------------------------------------------------------------
5 // Last modified: 10 October 2011 (DB)
6 // ---------------------------------------------------------------------------
7 // Provides the basic definitions for exporting & importing library symbols.
8 // Also provides some platform-specific rules for definitions.
9 // ***************************************************************************
11 #ifndef BAMTOOLS_GLOBAL_H
12 #define BAMTOOLS_GLOBAL_H
14 /*! \brief Library export macro
17 #ifndef BAMTOOLS_LIBRARY_EXPORT
19 # define BAMTOOLS_LIBRARY_EXPORT __declspec(dllexport)
21 # define BAMTOOLS_LIBRARY_EXPORT __attribute__((visibility("default")))
23 #endif // BAMTOOLS_LIBRARY_EXPORT
25 /*! \brief Library import macro
28 #ifndef BAMTOOLS_LIBRARY_IMPORT
30 # define BAMTOOLS_LIBRARY_IMPORT __declspec(dllimport)
32 # define BAMTOOLS_LIBRARY_IMPORT
34 #endif // BAMTOOLS_LIBRARY_IMPORT
36 /*! \brief Platform-specific type definitions
42 # define ftell64(a) _ftelli64(a)
43 # define fseek64(a,b,c) _fseeki64(a,b,c)
45 # define ftell64(a) ftello(a)
46 # define fseek64(a,b,c) fseeko(a,b,c)
48 #endif // BAMTOOLS_LFS
51 \brief Platform-independent tell() operation.
54 /*! \def fseek64(a,b,c)
55 \brief Platform-independent seek() operation.
59 /*! \brief Platform-specific type definitions
62 #ifndef BAMTOOLS_TYPES
63 #define BAMTOOLS_TYPES
66 typedef unsigned char uint8_t;
67 typedef short int16_t;
68 typedef unsigned short uint16_t;
70 typedef unsigned int uint32_t;
71 typedef long long int64_t;
72 typedef unsigned long long uint64_t;
76 #endif // BAMTOOLS_TYPES
79 inline void bamtools_noop(void) { }
81 /*! \brief Assert definitions
84 #ifndef BAMTOOLS_ASSERTS
85 #define BAMTOOLS_ASSERTS
87 # define BT_ASSERT_UNREACHABLE bamtools_noop()
88 # define BT_ASSERT_X( condition, message ) bamtools_noop()
92 # define BT_ASSERT_UNREACHABLE assert( false )
93 # define BT_ASSERT_X( condition, message ) if (!( condition )) { throw std::runtime_error( message ); }
95 #endif // BAMTOOLS_ASSERTS
97 #endif // BAMTOOLS_GLOBAL_H