Open Inventor Reference
SbBasic.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (C) 2000 Silicon Graphics, Inc. All Rights Reserved.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * Further, this software is distributed without any warranty that it is
16  * free of the rightful claim of any third person regarding infringement
17  * or the like. Any license provided herein, whether implied or
18  * otherwise, applies only to this software file. Patent licenses, if
19  * any, provided herein do not apply to combinations of this program with
20  * other software, or any other product whatsoever.
21  *
22  * You should have received a copy of the GNU Lesser General Public
23  * License along with this library; if not, write to the Free Software
24  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25  *
26  * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
27  * Mountain View, CA 94043, or:
28  *
29  * http://www.sgi.com
30  *
31  * For further information regarding this notice, see:
32  *
33  * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
34  *
35  */
36 
37 
38 /*
39  * Copyright (C) 1990,91 Silicon Graphics, Inc.
40  *
41  _______________________________________________________________________
42  ______________ S I L I C O N G R A P H I C S I N C . ____________
43  |
44  | $Revision: 1.2 $
45  |
46  | Description:
47  | This file contains basic SB library definitions.
48  |
49  | Author(s) : Paul S. Strauss, Nick Thompson
50  |
51  ______________ S I L I C O N G R A P H I C S I N C . ____________
52  _______________________________________________________________________
53  */
54 
55 #ifndef _SB_BASIC_
56 #define _SB_BASIC_
57 
65 #define SO_VERSION 2
66 #define SO_VERSION_REVISION 5
67 #define SO_VERSION_PATCHLEVEL 1
68 #define SGI_VERSION 20501
69 
70 #include "SbTypeDefs.h"
71 
72 #include <sys/types.h>
73 #include <stdio.h>
74 
75 #ifndef TRUE
76 #define TRUE 1
77 #endif
78 #ifndef FALSE
79 #define FALSE 0
80 #endif
81 
85 typedef bool SbBool;
86 
90 typedef size_t SbNodeIdType;
91 
97 
98 #ifdef __cplusplus
99 
100 template <class Type>
101 inline Type SbAbs( Type Val ) {
102  return (Val < 0) ? 0 - Val : Val;
103 }
104 
105 template <class Type>
106 inline void SbSwap( Type &A, Type &B ) {
107  Type T; T = A; A = B; B = T;
108 }
109 
110 template <class Type>
111 inline Type SbMin( const Type A, const Type B ) {
112  return (A < B) ? A : B;
113 }
114 
115 template <class Type>
116 inline Type SbMax( const Type A, const Type B ) {
117  return (A < B) ? B : A;
118 }
119 
120 template <class Type>
121 inline Type SbClamp( const Type Val, const Type Min, const Type Max ) {
122  return (Val < Min) ? Min : (Val > Max) ? Max : Val;
123 }
124 
125 #endif /* __cplusplus */
126 
153 
154 #define SoEXTENDER
155 #define SoINTERNAL
156 
157 #ifndef M_E
158 #define M_E 2.7182818284590452354
159 #endif
160 #ifndef M_LOG2E
161 #define M_LOG2E 1.4426950408889634074
162 #endif
163 #ifndef M_LOG10E
164 #define M_LOG10E 0.43429448190325182765
165 #endif
166 #ifndef M_LN2
167 #define M_LN2 0.69314718055994530942
168 #endif
169 #ifndef M_LN10
170 #define M_LN10 2.30258509299404568402
171 #endif
172 #ifndef M_PI
173 #define M_PI 3.14159265358979323846
174 #endif
175 #ifndef M_PI_2
176 #define M_PI_2 1.57079632679489661923
177 #endif
178 #ifndef M_PI_4
179 #define M_PI_4 0.78539816339744830962
180 #endif
181 #ifndef M_1_PI
182 #define M_1_PI 0.31830988618379067154
183 #endif
184 #ifndef M_2_PI
185 #define M_2_PI 0.63661977236758134308
186 #endif
187 #ifndef M_2_SQRTPI
188 #define M_2_SQRTPI 1.12837916709551257390
189 #endif
190 #ifndef M_SQRT2
191 #define M_SQRT2 1.41421356237309504880
192 #endif
193 #ifndef M_SQRT1_2
194 #define M_SQRT1_2 0.70710678118654752440
195 #endif
196 #ifndef MAXFLOAT
197 #define MAXFLOAT ((float)3.40282346638528860e+38)
198 #endif
199 
206 
207 #ifdef _DOUBLE_MATH_ONLY
208 
209 #define acosf acos
210 #define asinf asin
211 #define atanf atan
212 #define atan2f atan2
213 #define cosf cos
214 #define sinf sin
215 #define tanf tan
216 #define powf pow
217 #define sqrtf sqrt
218 
219 #endif /* _DOUBLE_MATH_ONLY */
220 
221 #endif /* _SB_BASIC_ */
bool SbBool
The original OIV version used SbBool as a typedef to int.
Definition: SbBasic.h:85
size_t SbNodeIdType
Type of unique ids of SoNode, used in the notification/change detection handling.
Definition: SbBasic.h:90