00001 #ifndef BABAR_HH 00002 #define BABAR_HH 00003 00004 //-------------------------------------------------------------------------- 00005 // File and Version Information: 00006 // $Id: BaBar.hh,v 1.2 2011/02/15 05:50:00 dengzy Exp $ 00007 // 00008 // Description: 00009 // Standard include file to contain global "fixes" 00010 // and type definitions 00011 // 00012 // This file is intended to be included by _lots_ of others 00013 // so should stay very light-weight. In particular, definitions 00014 // of static variables are not appropriate here, as they 00015 // will allocate memory in every BaBar object file. 00016 // 00017 // Environment: 00018 // Software developed for the BaBar Detector at the SLAC B-Factory. 00019 // 00020 // Author List: 00021 // David Quarrie 00022 // Bob Jacobsen (added F90 interface types, fixed bool, Mar 19,95) 00023 // Forest Rouse (added pi, bznom, chisq_undef, and epsilon) 00024 // Abi Soffer (added BbrLorentzVector) 00025 // A. De Silva (moved macros from Framework/AppModule.hh. Jan 29,99) 00026 // 00027 // Copyright Information: 00028 // Copyright (C) 1995, 1996 00029 // 00030 //------------------------------------------------------------------------ 00031 00032 // Need to make sure the very minimum gets into the dataflow builds 00033 #ifndef VXWORKS 00034 00035 // Define very large integer types. These types are required by the 00036 // POSIX specification. 00037 00038 #if defined(__SUNPRO_CC) || defined(__linux__) 00039 // ROOT's CINT cannot handle the type long long 00040 #ifndef __CINT__ 00041 //typedef long long int64_t; 00042 //typedef unsigned long long uint64_t; 00043 #endif 00044 #endif 00045 00046 00047 // Activate large file support for Sun if it isn't already. 00048 // This should be done in CPPFLAGS (and is) but a bug in the template 00049 // support in the Workshop 4.2 compiler causes some files to be 00050 // compiled with _FILE_OFFSET_BITS set to "'64'" instead of "64". // FIXME 00051 // NB: This _MUST_ be done before <sys/feature_tests.h> is included. 00052 #if defined(__SUNPRO_CC) 00053 #ifdef _LARGEFILE_SOURCE 00054 #undef _LARGEFILE_SOURCE 00055 #endif 00056 #define _LARGEFILE_SOURCE 1 00057 #ifdef _FILE_OFFSET_BITS 00058 #undef _FILE_OFFSET_BITS 00059 #endif 00060 #define _FILE_OFFSET_BITS 64 00061 #endif // Sun 00062 00063 00064 // The following two "paragraphs" of code seem to make the ROOT 00065 // interpreter unhappy. For now we protect it from them. This is 00066 // not an ideal solution. // FIXME 00067 #ifndef __CINT__ 00068 00069 // Load the various platforms' feature-test include files, so that we 00070 // can properly take advantage of the various *POSIX* and *XOPEN* macros. 00071 // There is no way to do this in a platform-independent way without 00072 // loading something heavyweight like <unistd.h>, which might affect 00073 // code that doesn't want it. [gpdf 2001.01.29] 00074 #ifdef __SUNPRO_CC 00075 #include <sys/feature_tests.h> 00076 #else 00077 #ifdef __linux__ 00078 #include <features.h> 00079 #else 00080 // Don't know what to do here. Try loading a lightweight include file. 00081 // On some platforms this brings in the feature tests, but not on all. 00082 #include <stddef.h> 00083 #endif 00084 #endif 00085 00086 00087 // Accommodate the variations in the adoption of socklen_t from Unix98. 00088 // Unix98 (XPG5) has socklen_t. Unix95 (XPG4v2) uses size_t (which is 00089 // typically unsigned) in places where socklen_t appears in Unix98. 00090 // Pre-standard APIs tend to have int instead. [added gpdf 2001.01.29] 00091 #if ( defined(_XOPEN_SOURCE) && ( _XOPEN_SOURCE - 0 ) >= 500 ) 00092 // Unix98 (XPG5): Solaris 7 with -D_XOPEN_SOURCE=500, Linux 00093 #define BABAR_socklen_t socklen_t 00094 #else 00095 #ifdef _XOPEN_SOURCE_EXTENDED 00096 // Unix95 (XPG4v2): OSF, Solaris 2.6 with -D_XOPEN_SOURCE_EXTENDED 00097 #define BABAR_socklen_t size_t 00098 #else 00099 // pre-standard: Solaris 7 & 2.6 "plain vanilla" 00100 #define BABAR_socklen_t int 00101 #endif 00102 #endif 00103 00104 #endif // ifndef __CINT__ 00105 00106 #if defined(__SUNPRO_CC) && \ 00107 ( !defined(__EXTENSIONS__) && \ 00108 ( defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) ) ) 00109 // This one is in the libraries on Solaris but only has a prototype 00110 // defined in <signal.h> if pure-Unix95/98 compilation is not in force. 00111 // We just restore the prototype. 00112 extern "C" char* strsignal( int sig ); 00113 #endif 00114 00115 // An error in the construction of the system and C++ header files on 00116 // Solaris 8 / Workshop 6 Updates 1&2 leads to a conflict between the use 00117 // of ::clock_t and std::clock_t when <string> is compiled under 00118 // -D_XOPEN_SOURCE=500. The following code ensures that ::clock_t is 00119 // always defined and thus allows <string> to compile. 00120 // This is just a workaround and should be monitored as compiler and 00121 // operating system versions evolve. [gpdf 2002.02.05] 00122 #if defined(__SUNPRO_CC) && defined(_XOPEN_SOURCE) && ( _XOPEN_SOURCE - 0 ==500 ) 00123 #ifndef _CLOCK_T 00124 #define _CLOCK_T 00125 typedef long clock_t; /* relative time in a specified resolution 00126 */ 00127 #endif /* ifndef _CLOCK_T */ 00128 #endif // SUN and XOPENSOURCE=500 00129 00130 00131 #if defined(__SUNPRO_CC) 00132 // There are two forms of each of the std::count and std::distance 00133 // functions: a pre-standard version that requires an extra argument 00134 // to hold the result, and a newer version, which made it into the 00135 // standard, that returns its result. On Solaris, the STL is built 00136 // with the _RWSTD_NO_CLASS_PARTIAL_SPEC flag set, which disables the 00137 // new forms. The following is an emulation of the standard versions. 00138 // Although this is not complete, it enables us to compile (our 00139 // current) standard code on Solaris. [bartoldu 2004.07.20] 00140 // 00141 // I included std::count_if here as well which suffers from the same 00142 problem. 00143 // [narsky 2005.02.18] 00144 00145 #include <stddef.h> 00146 00147 namespace std 00148 { 00149 template <class InputIterator, class T> 00150 ptrdiff_t 00151 count (InputIterator first, InputIterator last, const T& value); 00152 00153 template <class InputIterator, class Predicate> 00154 ptrdiff_t 00155 count_if (InputIterator first, InputIterator last, Predicate pred); 00156 00157 template <class InputIterator> 00158 ptrdiff_t 00159 distance (InputIterator first, InputIterator last); 00160 } 00161 00162 #ifdef BABAR_COMP_INST 00163 #include "BaBar/BaBar.cc" 00164 #endif // BABAR_COMP_INST 00165 00166 #endif // SUNCC 00167 00168 00169 // This block is for Mac OSX 10.3.5 with gcc 3.3 00170 #ifdef __APPLE_CC__ 00171 00172 // No clock_gettime in <time.h> 00173 typedef int clockid_t; 00174 #ifndef CLOCK_REALTIME 00175 #define CLOCK_REALTIME 0 00176 00177 // No ENODATA, this is used in OepRemoteFramework 00178 #define ENODATA 61 00179 00180 // No O_LARGEFILE as this is a 64bit platform 00181 // Used in OepFramework and OlmMerger 00182 #define O_LARGEFILE 0 00183 00184 #endif 00185 00186 // <cmath> undefines isnan() and friends without providing replacements 00187 // Only isnan() and isfinite() are used in BaBar; leave the others alone 00188 00189 #if !defined(isfinite) 00190 extern "C" int isfinite(double); 00191 #endif 00192 #if !defined(isnan) 00193 extern "C" int isnan(double); 00194 #endif 00195 00196 // ROOT's CINT has a problem with timespec not being defined 00197 #ifndef __CINT__ 00198 int clock_gettime ( clockid_t clock_id, struct timespec *tp); 00199 #endif 00200 00201 #endif // __APPLE_CC__ 00202 00203 #endif // VXWORKS 00204 00205 // Only below here should be seen by VXWORKS 00206 00207 00208 // DO NOT ADD NEW ENTRIES HERE, ONLY ABOVE THE #endif // VXWORKS !!!! 00209 00210 #endif // BABAR_HH