CGEM BOSS 6.6.5.g
BESIII Offline Software System
Loading...
Searching...
No Matches
BaBar.hh
Go to the documentation of this file.
1#ifndef BABAR_HH
2#define BABAR_HH
3
4//--------------------------------------------------------------------------
5// File and Version Information:
6// $Id: BaBar.hh,v 1.2 2011/02/15 05:50:00 dengzy Exp $
7//
8// Description:
9// Standard include file to contain global "fixes"
10// and type definitions
11//
12// This file is intended to be included by _lots_ of others
13// so should stay very light-weight. In particular, definitions
14// of static variables are not appropriate here, as they
15// will allocate memory in every BaBar object file.
16//
17// Environment:
18// Software developed for the BaBar Detector at the SLAC B-Factory.
19//
20// Author List:
21// David Quarrie
22// Bob Jacobsen (added F90 interface types, fixed bool, Mar 19,95)
23// Forest Rouse (added pi, bznom, chisq_undef, and epsilon)
24// Abi Soffer (added BbrLorentzVector)
25// A. De Silva (moved macros from Framework/AppModule.hh. Jan 29,99)
26//
27// Copyright Information:
28// Copyright (C) 1995, 1996
29//
30//------------------------------------------------------------------------
31
32// Need to make sure the very minimum gets into the dataflow builds
33#ifndef VXWORKS
34
35// Define very large integer types. These types are required by the
36// POSIX specification.
37
38#if defined(__SUNPRO_CC) || defined(__linux__)
39// ROOT's CINT cannot handle the type long long
40#ifndef __CINT__
41//typedef long long int64_t;
42//typedef unsigned long long uint64_t;
43#endif
44#endif
45
46
47// Activate large file support for Sun if it isn't already.
48// This should be done in CPPFLAGS (and is) but a bug in the template
49// support in the Workshop 4.2 compiler causes some files to be
50// compiled with _FILE_OFFSET_BITS set to "'64'" instead of "64". // FIXME
51// NB: This _MUST_ be done before <sys/feature_tests.h> is included.
52#if defined(__SUNPRO_CC)
53#ifdef _LARGEFILE_SOURCE
54#undef _LARGEFILE_SOURCE
55#endif
56#define _LARGEFILE_SOURCE 1
57#ifdef _FILE_OFFSET_BITS
58#undef _FILE_OFFSET_BITS
59#endif
60#define _FILE_OFFSET_BITS 64
61#endif // Sun
62
63
64// The following two "paragraphs" of code seem to make the ROOT
65// interpreter unhappy. For now we protect it from them. This is
66// not an ideal solution. // FIXME
67#ifndef __CINT__
68
69// Load the various platforms' feature-test include files, so that we
70// can properly take advantage of the various *POSIX* and *XOPEN* macros.
71// There is no way to do this in a platform-independent way without
72// loading something heavyweight like <unistd.h>, which might affect
73// code that doesn't want it. [gpdf 2001.01.29]
74#ifdef __SUNPRO_CC
75 #include <sys/feature_tests.h>
76#else
77 #ifdef __linux__
78 #include <features.h>
79 #else
80 // Don't know what to do here. Try loading a lightweight include file.
81 // On some platforms this brings in the feature tests, but not on all.
82 #include <stddef.h>
83 #endif
84#endif
85
86
87// Accommodate the variations in the adoption of socklen_t from Unix98.
88// Unix98 (XPG5) has socklen_t. Unix95 (XPG4v2) uses size_t (which is
89// typically unsigned) in places where socklen_t appears in Unix98.
90// Pre-standard APIs tend to have int instead. [added gpdf 2001.01.29]
91#if ( defined(_XOPEN_SOURCE) && ( _XOPEN_SOURCE - 0 ) >= 500 )
92// Unix98 (XPG5): Solaris 7 with -D_XOPEN_SOURCE=500, Linux
93 #define BABAR_socklen_t socklen_t
94#else
95 #ifdef _XOPEN_SOURCE_EXTENDED
96 // Unix95 (XPG4v2): OSF, Solaris 2.6 with -D_XOPEN_SOURCE_EXTENDED
97 #define BABAR_socklen_t size_t
98 #else
99 // pre-standard: Solaris 7 & 2.6 "plain vanilla"
100 #define BABAR_socklen_t int
101 #endif
102#endif
103
104#endif // ifndef __CINT__
105
106#if defined(__SUNPRO_CC) && \
107 ( !defined(__EXTENSIONS__) && \
108 ( defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) ) )
109// This one is in the libraries on Solaris but only has a prototype
110// defined in <signal.h> if pure-Unix95/98 compilation is not in force.
111// We just restore the prototype.
112extern "C" char* strsignal( int sig );
113#endif
114
115// An error in the construction of the system and C++ header files on
116// Solaris 8 / Workshop 6 Updates 1&2 leads to a conflict between the use
117// of ::clock_t and std::clock_t when <string> is compiled under
118// -D_XOPEN_SOURCE=500. The following code ensures that ::clock_t is
119// always defined and thus allows <string> to compile.
120// This is just a workaround and should be monitored as compiler and
121// operating system versions evolve. [gpdf 2002.02.05]
122#if defined(__SUNPRO_CC) && defined(_XOPEN_SOURCE) && ( _XOPEN_SOURCE - 0 ==500 )
123#ifndef _CLOCK_T
124#define _CLOCK_T
125typedef long clock_t; /* relative time in a specified resolution
126*/
127#endif /* ifndef _CLOCK_T */
128#endif // SUN and XOPENSOURCE=500
129
130
131#if defined(__SUNPRO_CC)
132// There are two forms of each of the std::count and std::distance
133// functions: a pre-standard version that requires an extra argument
134// to hold the result, and a newer version, which made it into the
135// standard, that returns its result. On Solaris, the STL is built
136// with the _RWSTD_NO_CLASS_PARTIAL_SPEC flag set, which disables the
137// new forms. The following is an emulation of the standard versions.
138// Although this is not complete, it enables us to compile (our
139// current) standard code on Solaris. [bartoldu 2004.07.20]
140//
141// I included std::count_if here as well which suffers from the same
142problem.
143// [narsky 2005.02.18]
144
145#include <stddef.h>
146
147namespace std
148{
149 template <class InputIterator, class T>
150 ptrdiff_t
151 count (InputIterator first, InputIterator last, const T& value);
152
153 template <class InputIterator, class Predicate>
154 ptrdiff_t
155 count_if (InputIterator first, InputIterator last, Predicate pred);
156
157 template <class InputIterator>
158 ptrdiff_t
159 distance (InputIterator first, InputIterator last);
160}
161
162#ifdef BABAR_COMP_INST
163#include "BaBar/BaBar.cc"
164#endif // BABAR_COMP_INST
165
166#endif // SUNCC
167
168
169// This block is for Mac OSX 10.3.5 with gcc 3.3
170#ifdef __APPLE_CC__
171
172// No clock_gettime in <time.h>
173typedef int clockid_t;
174#ifndef CLOCK_REALTIME
175#define CLOCK_REALTIME 0
176
177// No ENODATA, this is used in OepRemoteFramework
178#define ENODATA 61
179
180// No O_LARGEFILE as this is a 64bit platform
181// Used in OepFramework and OlmMerger
182#define O_LARGEFILE 0
183
184#endif
185
186// <cmath> undefines isnan() and friends without providing replacements
187// Only isnan() and isfinite() are used in BaBar; leave the others alone
188
189#if !defined(isfinite)
190extern "C" int isfinite(double);
191#endif
192#if !defined(isnan)
193extern "C" int isnan(double);
194#endif
195
196// ROOT's CINT has a problem with timespec not being defined
197#ifndef __CINT__
198int clock_gettime ( clockid_t clock_id, struct timespec *tp);
199#endif
200
201#endif // __APPLE_CC__
202
203#endif // VXWORKS
204
205// Only below here should be seen by VXWORKS
206
207
208// DO NOT ADD NEW ENTRIES HERE, ONLY ABOVE THE #endif // VXWORKS !!!!
209
210#endif // BABAR_HH