Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

gnDefs.h

Go to the documentation of this file.
00001 /////////////////////////////////////////////////////////////////////////////
00002 // File:            gn/gnDefs.h
00003 // Purpose:         Defines common constants in libGenome.
00004 // Description:     Defines, consts, typedef etc for libGenome
00005 // Rev:             A
00006 // Author:          Aaron Darling 
00007 // Modified by:     
00008 // Copyright:       (c) Aaron Darling 
00009 // Licenses:        See COPYING file for details 
00010 /////////////////////////////////////////////////////////////////////////////
00011 #ifndef _gnDefs_h_
00012 #define _gnDefs_h_
00013 
00014 #ifdef __GNUG__
00015     #pragma interface "gn/gnDefs.h"
00016 #endif
00017 
00018 #include <limits.h>
00019 #include <float.h>
00020 #include "gn/gnSetup.h"
00021 
00022 // bool 
00023 typedef unsigned char        boolean;
00024 typedef unsigned char        int1;
00025 // signed
00026 typedef signed char          int8;
00027 typedef signed short int     int16;
00028 typedef signed int           int32;
00029 typedef signed long long     int64;
00030 typedef signed char          sint8;
00031 typedef signed short int     sint16;
00032 typedef signed int           sint32;
00033 typedef signed long int      sint64;
00034 // unsigned
00035 typedef unsigned char        uint8;
00036 typedef unsigned short int   uint16;
00037 typedef unsigned int         uint32;
00038 typedef unsigned long long   uint64;
00039 typedef unsigned int         uint;
00040 // float
00041 typedef float                float32;
00042 typedef double               float64;
00043 
00044 // defines
00045 #ifndef TRUE
00046 #define TRUE                 1
00047 #endif
00048 #ifndef FALSE
00049 #define FALSE                0
00050 #endif
00051 #ifndef PI
00052 #define PI                   3.1415926535897932384626433832795028
00053 #endif
00054 
00055 #define BOOLEAN_MIN              0
00056 #define BOOLEAN_MAX          1
00057 #define INT0_MIN                 0
00058 #define INT1_MAX             1
00059 
00060 #define INT8_BYTE_SIZE       1
00061 #define INT16_BYTE_SIZE      2
00062 #define INT32_BYTE_SIZE      4
00063 #define INT64_BYTE_SIZE      8
00064 
00065 #define INT8_BIT_SIZE        8
00066 #define INT16_BIT_SIZE       16
00067 #define INT32_BIT_SIZE       32
00068 #define INT64_BIT_SIZE       64
00069 
00070 #define UINT8_BYTE_SIZE      1
00071 #define UINT16_BYTE_SIZE     2
00072 #define UINT32_BYTE_SIZE     4
00073 #define UINT64_BYTE_SIZE     8
00074 
00075 #define UINT8_BIT_SIZE       8
00076 #define UINT16_BIT_SIZE      16
00077 #define UINT32_BIT_SIZE      32
00078 #define UINT64_BIT_SIZE      64
00079 
00080 // limits.h
00081 #define INT8_MIN             SCHAR_MIN   //0x00
00082 #define INT8_MAX             SCHAR_MAX   //0x7f
00083 #define INT16_MIN            SHRT_MIN    //0x0000
00084 #define INT16_MAX            SHRT_MAX    //0x7fff
00085 #define INT32_MIN            INT_MIN     //0x0000000
00086 #define INT32_MAX            INT_MAX     //0x7fffffff
00087 #define INT64_MIN            LONG_MIN    //0x0000000000000000
00088 #define INT64_MAX            LONG_MAX    //0x7fffffffffffffff
00089 
00090 #define UINT8_MIN            0           //0x00
00091 #define UINT8_MAX            UCHAR_MAX   //0xff
00092 #define UINT16_MIN           0           //0x0000
00093 #define UINT16_MAX           USHRT_MAX   //0xffff
00094 #define UINT32_MIN           0           //0x00000000
00095 #define UINT32_MAX           UINT_MAX    //0xffffffff
00096 #define UINT64_MIN           0           //0x0000000000000000
00097 #define UINT64_MAX           ULONG_MAX   //0xffffffffffffffff
00098 
00099 // float.h
00100 #define FLOAT32_MIN          FLT_MIN
00101 #define FLOAT32_MAX          FLT_MAX
00102 #define FLOAT32_MIN_EXP      FLT_MIN_EXP
00103 #define FLOAT32_MAX_EXP      FLT_MAX_EXP
00104 #define FLOAT32_MIN_10_EXP   FLT_MIN_10_EXP
00105 #define FLOAT32_MAX_10_EXP   FLT_MAX_10_EXP
00106 #define FLOAT32_DIGIT        FLT_DIG
00107 #define FLOAT32_RADIX        FLT_RADIX
00108 #define FLOAT32_MIN_FRACTION FLT_EPSILON
00109 
00110 #define FLOAT64_MIN          DBL_MIN
00111 #define FLOAT64_MAX          DBL_MAX
00112 #define FLOAT64_MIN_EXP      DBL_MIN_EXP
00113 #define FLOAT64_MAX_EXP      DBL_MAX_EXP
00114 #define FLOAT64_MIN_10_EXP   DBL_MIN_10_EXP
00115 #define FLOAT64_MAX_10_EXP   DBL_MAX_10_EXP
00116 #define FLOAT64_DIGIT        DBL_DIG
00117 #define FLOAT64_RADIX        DBL_RADIX
00118 #define FLOAT64_MIN_FRACTION DBL_EPSILON
00119 
00120 // Sequence Types
00121 typedef char                            gnSeqC;         // Sequence Character
00122 typedef uint32                          gnSeqI;         // Sequence Index
00123 
00124 #define GNSEQI_ERROR            UINT32_MAX      // return value
00125 #define GNSEQI_END                      UINT32_MAX      // argument value
00126 #define GNSEQI_BEGIN            UINT32_MIN      // argument value
00127 #define GNSEQC_NULL                     0
00128 #define GNSEQC_MIN                      INT8_MIN
00129 #define GNSEQC_MAX                      INT8_MAX
00130 
00131 
00132 #define CONTIG_SECTION_SIZE 3
00133 enum gnContigSection{
00134         gnContigHeader = 0,
00135         gnContigAnnotation = 1,
00136         gnContigSequence = 2
00137 };
00138 
00139 enum gnNewlineType{
00140         gnNewlineUnix = 0,
00141         gnNewlineWindows = 1,
00142         gnNewlineMac = 2
00143 };
00144 
00145 static const uint32 ALL_CONTIGS = UINT32_MAX;
00146 static const uint32 BUFFER_SIZE = 100000;
00147 
00148 /**
00149  * Class used to ensure correct deallocation of arrays.
00150  */
00151 template<class T>
00152 class Array{
00153 public:
00154         /** Allocate a new array of length "bufsize".  The array can be
00155          * accessed through the data member
00156          */
00157         Array( uint64 bufsize ){
00158                 data = new T[bufsize];
00159         }
00160         ~Array() { 
00161                 if (data != NULL)
00162                         delete[] data;
00163         }
00164         /** The actual array */
00165         T* data;
00166 private:
00167         Array( const Array& a );
00168         Array& operator=( const Array& a );
00169         Array(){};
00170 };
00171 
00172 #endif
00173         //_gnDefs_h_

Generated on Mon Feb 3 02:34:39 2003 for libGenome by doxygen1.3-rc3