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

SbBasic.h

00001 /* include/Inventor/SbBasic.h.  Generated automatically by configure.  */
00002 /**************************************************************************\
00003  *
00004  *  This file is part of the Coin 3D visualization library.
00005  *  Copyright (C) 1998-2002 by Systems in Motion. All rights reserved.
00006  *
00007  *  This library is free software; you can redistribute it and/or
00008  *  modify it under the terms of the GNU Lesser General Public License
00009  *  version 2.1 as published by the Free Software Foundation. See the
00010  *  file LICENSE.LGPL at the root directory of the distribution for
00011  *  more details.
00012  *
00013  *  If you want to use Coin for applications not compatible with the
00014  *  LGPL, please contact SIM to acquire a Professional Edition license.
00015  *
00016  *  Systems in Motion, Prof Brochs gate 6, 7030 Trondheim, NORWAY
00017  *  http://www.sim.no support@sim.no Voice: +47 22114160 Fax: +47 22207097
00018  *
00019 \**************************************************************************/
00020 
00021 #ifndef COIN_SBBASIC_H
00022 #define COIN_SBBASIC_H
00023 
00024 /*
00025   NOTE: SbBasic.h is automatically generated from SbBasic.h.in, so
00026   don't edit SbBasic.h directly.
00027 */
00028 
00029 /* *********************************************************************** */
00030 
00031 /* FIXME: should use "bool" instead of "int" in the following typedef
00032    if the "bool" keyword is supported by the compiler. Breaks
00033    ABI-compatibility, though, so wait until Coin v2. (Should then also
00034    use "false" and "true" instead of "0" and "1" for the FALSE and
00035    TRUE defines below.) 20010810 mortene. */
00036 
00037 /* Documented for Doxygen in SoDB.cpp. */
00038 typedef int SbBool;
00039 
00040 #ifndef FALSE
00041 #define FALSE 0
00042 #endif /* !FALSE */
00043 #ifndef TRUE
00044 #define TRUE  1
00045 #endif /* !TRUE */
00046 
00047 /* *********************************************************************** */
00048 
00049 /* Include these for Open Inventor compatibility reasons (they are not
00050  * actually used in Coin.)
00051  */
00052 #define SoEXTENDER
00053 #define SoINTERNAL
00054 
00055 /* Include this to 1) be compatible with Open Inventor's SbBasic.h, 2)
00056  * provide a way for application programmers to get hold of the type
00057  * definitions without explicitly including inttypes.h.
00058  *
00059  * The latter point is important because the inttypes.h file in SGI
00060  * and TGS Open Inventor is placed _below_ the Inventor/ directory in
00061  * the header files hierarchy. This is a stupid thing to do because it
00062  * could easily conflict with the inttypes.h file installed as part of
00063  * the C library on many systems (like GNU/Linux's glibc, for
00064  * instance).
00065  */
00066 #include <Inventor/system/inttypes.h>
00067 
00068 /* Internal note for Coin developers: in other sourcefiles in Coin, we
00069  * depend on math.h being included in SbBasic.h. It is done this way
00070  * to always make sure we have the M_* symbols available under MSWin
00071  * (see below). So don't remove the following line unless you know
00072  * very well what you are doing.
00073  */
00074 #include <math.h>
00075 
00076 /* Define misc values if they are not available from math.h. UNIX
00077  * systems typically have these defines, and MSWindows systems don't.
00078  */
00079 #ifndef M_E
00080 #define M_E 2.7182818284590452354
00081 #endif /* !M_E */
00082 #ifndef M_LOG2E
00083 #define M_LOG2E 1.4426950408889634074
00084 #endif /* !M_LOG2E */
00085 #ifndef M_LOG10E
00086 #define M_LOG10E 0.43429448190325182765
00087 #endif /* !M_LOG10E */
00088 #ifndef M_LN2
00089 #define M_LN2 0.69314718055994530942
00090 #endif /* !M_LN2 */
00091 #ifndef M_LN10
00092 #define M_LN10 2.30258509299404568402
00093 #endif /* !M_LN10 */
00094 #ifndef M_PI
00095 #define M_PI 3.14159265358979323846
00096 #endif /* !M_PI */
00097 #ifndef M_TWOPI
00098 #define M_TWOPI (M_PI * 2.0)
00099 #endif /* !M_TWOPI */
00100 #ifndef M_PI_2
00101 #define M_PI_2 1.57079632679489661923
00102 #endif /* !M_PI_2 */
00103 #ifndef M_PI_4
00104 #define M_PI_4 0.78539816339744830962
00105 #endif /* !M_PI_4 */
00106 #ifndef M_3PI_4
00107 #define M_3PI_4 2.3561944901923448370E0
00108 #endif /* !M_3PI_4 */
00109 #ifndef M_SQRTPI
00110 #define M_SQRTPI 1.77245385090551602792981
00111 #endif /* !M_SQRTPI */
00112 #ifndef M_1_PI
00113 #define M_1_PI 0.31830988618379067154
00114 #endif /* !M_1_PI */
00115 #ifndef M_2_PI
00116 #define M_2_PI 0.63661977236758134308
00117 #endif /* !M_2_PI */
00118 #ifndef M_2_SQRTPI
00119 #define M_2_SQRTPI 1.12837916709551257390
00120 #endif /* !M_2_SQRTPI */
00121 #ifndef M_SQRT2
00122 #define M_SQRT2 1.41421356237309504880
00123 #endif /* !M_SQRT2 */
00124 #ifndef M_SQRT1_2
00125 #define M_SQRT1_2 0.70710678118654752440
00126 #endif /* !M_SQRT1_2 */
00127 #ifndef M_LN2LO
00128 #define M_LN2LO 1.9082149292705877000E-10
00129 #endif /* !M_LN2LO */
00130 #ifndef M_LN2HI
00131 #define M_LN2HI 6.9314718036912381649E-1
00132 #endif /* !M_LN2HI */
00133 #ifndef M_SQRT3
00134 #define M_SQRT3 1.73205080756887719000
00135 #endif /* !M_SQRT3 */
00136 #ifndef M_IVLN10
00137 #define M_IVLN10 0.43429448190325182765 /* 1 / log(10) */
00138 #endif /* !M_IVLN10 */
00139 #ifndef M_LOG2_E
00140 #define M_LOG2_E 0.693147180559945309417
00141 #endif /* !M_LOG2_E */
00142 #ifndef M_INVLN2
00143 #define M_INVLN2 1.4426950408889633870E0 /* 1 / log(2) */
00144 #endif /* !M_INVLN2 */
00145 
00146 /* *********************************************************************** */
00147 
00148 /* A unique identifier to recognize whether or not we're running under
00149  * Systems in Motion's Coin library.
00150  */
00151 #define __COIN__
00152 
00153 /* The following #undef'ed defines are automatically defined and
00154  * synchronized with the settings in configure.in when ``configure''
00155  * is executed.
00156  *
00157  * The #ifndef wrapper is necessary because during development, these
00158  * are also defined in the config.h file generated by ``configure''.
00159  */
00160 #ifndef COIN_VERSION
00161 
00162 /* These are available for adding or omitting features based on Coin
00163  * version numbers in client application sources. */
00164 #define COIN_MAJOR_VERSION 1
00165 #define COIN_MINOR_VERSION 0
00166 #define COIN_MICRO_VERSION 3
00167 #define COIN_VERSION "1.0.3b"
00168 
00169 /* This define is set by the configure script if singleprecision math
00170    functions are available from the C library API headers. */
00171 /* #undef HAVE_SINGLEPRECISION_MATH */
00172 
00173 /* Most compilers should have "hash quoting", as it is part of the
00174    ANSI standard. */
00175 #define HAVE_HASH_QUOTING 1
00176 /* #undef HAVE_APOSTROPHES_QUOTING */
00177 
00178 /* IN_PATH define in HPUX's sys/unistd.h conflicts with SoAction::IN_PATH */
00179 /* #undef COIN_UNDEF_IN_PATH_HACK */
00180 
00181 #endif /* !COIN_VERSION */ /* Ends configure-generated defines. */
00182 
00183 
00184 /* *********************************************************************** */
00185 
00186 #ifndef HAVE_SINGLEPRECISION_MATH
00187 /* If singleprecision math functions are missing, define them to their
00188    doubleprecision counterparts. This is done to be consistent with
00189    SbBasic.h in Open Inventor (application programmers might rely on
00190    the float-versions being set up from the Inventor SbBasic.h). */
00191 #define cosf cos
00192 #define sinf sin
00193 #define tanf tan
00194 #define powf pow
00195 #define sqrtf sqrt
00196 #define acosf acos
00197 #define asinf asin
00198 #define atanf atan
00199 #define atan2f atan2
00200 #endif /* HAVE_SINGLEPRECISION_MATH */
00201 
00202 
00203 /* Some useful inline template functions (instead of macros):
00204  *   SbAbs(Val)              - returns absolute value
00205  *   SbMin(Val1, Val2)       - returns minimum value
00206  *   SbMax(Val1, Val2)       - returns maximum value
00207  *   SbClamp(Val, Min, Max)  - returns clamped value
00208  *   SbSwap(Val1, Val2)      - swaps the two values (no return value)
00209  *   SbSqr(val)              - returns (val)²
00210  *
00211  * FIXME: write Doxygen doc for these methods. 19990425 mortene.
00212  */
00213 
00214 #ifdef __cplusplus
00215 
00216 template <class Type>
00217 inline Type SbAbs( Type Val ) {
00218   return (Val < 0) ? 0 - Val : Val;
00219 }
00220 
00221 template <class Type>
00222 inline Type SbMax( const Type A, const Type B ) {
00223   return (A < B) ? B : A;
00224 }
00225 
00226 template <class Type>
00227 inline Type SbMin( const Type A, const Type B ) {
00228   return (A < B) ? A : B;
00229 }
00230 
00231 template <class Type>
00232 inline Type SbClamp( const Type Val, const Type Min, const Type Max ) {
00233   return (Val < Min) ? Min : (Val > Max) ? Max : Val;
00234 }
00235 
00236 template <class Type>
00237 inline void SbSwap( Type & A, Type & B ) {
00238   Type T; T = A; A = B; B = T;
00239 }
00240 
00241 template <class Type>
00242 inline Type SbSqr(const Type val) {
00243   return val * val;
00244 }
00245 
00246 #endif /* __cplusplus */
00247 
00248 /* *********************************************************************** */
00249 
00250 /* SO__QUOTE(str)        - use the preprocessor to quote a string.
00251  * SO__CONCAT(str1,str2) - use the preprocessor to concatenate two strings.
00252  */
00253 
00254 #ifdef HAVE_HASH_QUOTING
00255 #define SO__QUOTE(str)           #str
00256 #define SO__CONCAT(str1, str2)   str1##str2
00257 #elif defined(HAVE_APOSTROPHES_QUOTING)
00258 #define SO__QUOTE(str)           "str"
00259 #define SO__CONCAT(str1, str2)   str1str2
00260 #else
00261 #error No valid way to do macro quoting!
00262 #endif
00263 
00264 /* *********************************************************************** */
00265 
00266 /* Precaution to avoid an some errors easily made by the application
00267    programmer. */
00268 #ifdef COIN_DLL_API
00269 # error Leave the internal COIN_DLL_API define alone.
00270 #endif /* COIN_DLL_API */
00271 #ifdef COIN_INTERNAL
00272 # ifdef COIN_NOT_DLL
00273 #  error The COIN_NOT_DLL define is not supposed to be used when building the library, only when building Win32 applications.
00274 # endif /* COIN_INTERNAL && COIN_NOT_DLL */
00275 # ifdef COIN_DLL
00276 #  error The COIN_DLL define is not supposed to be used when building the library, only when building Win32 applications.
00277 # endif /* COIN_INTERNAL && COIN_DLL */
00278 #endif /* COIN_INTERNAL */
00279 
00280 /*
00281   On MSWindows platforms, one of these defines must always be set when
00282   building application programs:
00283 
00284    - "COIN_DLL", when the application programmer is using the library
00285      in the form of a dynamic link library (DLL)
00286 
00287    - "COIN_NOT_DLL", when the application programmer is using the
00288      library in the form of a static object library (LIB)
00289 
00290   Note that either COIN_DLL or COIN_NOT_DLL _must_ be defined by the
00291   application programmer on MSWindows platforms, or else the #error
00292   statement will hit. Set up one or the other of these two defines in
00293   your compiler environment according to how the library was built --
00294   as a DLL (use "COIN_DLL") or as a LIB (use "COIN_NOT_DLL").
00295 
00296   (Setting up defines for the compiler is typically done by either
00297   adding something like "/DCOIN_DLL" to the compiler's argument line
00298   (for command-line build processes), or by adding the define to the
00299   list of preprocessor symbols in your IDE GUI (in the MSVC IDE, this
00300   is done from the "Project"->"Settings" menu, choose the "C/C++" tab,
00301   then "Preprocessor" from the dropdown box and add the appropriate
00302   define)).
00303 
00304   It is extremely important that the application programmer uses the
00305   correct define, as using "COIN_NOT_DLL" when "COIN_DLL" is correct
00306   will cause mysterious crashes.
00307  */
00308 /* FIXME: use a feature check to see if this is a platform which can
00309    recognize the __declspec keyword instead of the crap #if below.
00310    20011201 mortene. */
00311 #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
00312 # ifdef COIN_INTERNAL
00313 #  ifdef COIN_MAKE_DLL
00314 #   define COIN_DLL_API __declspec(dllexport)
00315 #  endif /* COIN_MAKE_DLL */
00316 # else /* !COIN_INTERNAL */
00317 #  ifdef COIN_DLL
00318 #   define COIN_DLL_API __declspec(dllimport)
00319 #  else /* !COIN_DLL */
00320 #   ifndef COIN_NOT_DLL
00321 #    error Define either COIN_DLL or COIN_NOT_DLL as appropriate for your linkage! See Inventor/SbBasic.h for further instructions.
00322 #   endif /* COIN_NOT_DLL */
00323 #  endif /* !COIN_DLL */
00324 # endif /* !COIN_INTERNAL */
00325 #endif /* Microsoft Windows */
00326 
00327 /* Empty define to avoid errors when _not_ compiling an MSWindows DLL. */
00328 #ifndef COIN_DLL_API
00329 # define COIN_DLL_API
00330 #endif /* !COIN_DLL_API */
00331 
00332 
00333 #endif /* !COIN_SBBASIC_H */

Generated at Tue Mar 5 03:31:11 2002 for Coin by doxygen1.2.9 written by Dimitri van Heesch, © 1997-2001