aimstil  5.0.5
til_common.h
Go to the documentation of this file.
1 #ifndef TIL_TIL_COMMON_H
2 #define TIL_TIL_COMMON_H
3 
6 
7 #include <cmath> // sqrt
8 #include <iostream>
9 
10 #ifdef _MSC_VER
11 #pragma inline_depth(30)
12 #endif
13 
14 // A definition used to declare friend template functions inside classes
15 // and still being to compile both with MSVC and GCC
16 #ifdef _MSC_VER
17 #define FRIEND_TEMPLATE_NO_ARG
18 #else
19 #define FRIEND_TEMPLATE_NO_ARG <>
20 #endif
21 
22 // Define INLINE
23 #ifdef _MSC_VER
24 #define INLINE __forceinline
25 #else
26 #define INLINE inline
27 #endif
28 
29 
30 #if defined( _WIN32 ) && !defined( _GNUC )
31 // A definition to export/import objects and declarations, depending on whether
32 // these are used inside or outide the library
33 #ifdef aimstil_EXPORTS
34 #define TIL_API __declspec(dllexport)
35 #define EXPIMP_TEMPLATE
36 #else
37 #define TIL_API __declspec(dllimport)
38 #define EXPIMP_TEMPLATE extern
39 #endif
40 #else // WIN32
41 // On linux, we don't need this crap apparently
42 #define TIL_API
43 #define EXPIMP_TEMPLATE
44 #endif
45 
46 // Define M_PI if it is not defined already
47 #ifndef M_PI
48 #define M_PI 3.14159265358979323846
49 #endif
50 
51 
52 // A macro useful to write wrapper functions
53 // TODO: rename into TIL_EXPAND_VECTOR3D
54 #define EXPAND_VECTOR(v) v[0], v[1], v[2]
55 
56 // Signal windows.h not to define 'min' and 'max' macros. This should helfully tackle the
57 // belowmentionned problem.
58 #ifndef NOMINMAX
59 #define NOMINMAX 1
60 #endif
61 /*
62 // Undefine 'min' and 'max' macros,
63 // defined in one of the windows include files
64 #ifdef min
65 #undef min
66 #endif
67 #ifdef max
68 #undef max
69 #endif
70 */
71 
72 namespace til
73 {
74  // Convenient typedefs on unsigned types
75  typedef unsigned char uchar;
76  typedef unsigned short ushort;
77 
79  inline void warning(const char * msg) { std::cout << "TIL warning: " << msg << std::endl; }
80 
82  struct None {};
83 
85  struct NoInit {};
86  const NoInit no_init = NoInit();
87 
88 } // namespace til
89 
90 
91 // Package include
92 // TODO: not sure whether this should stay that way...
94 
95 #endif
96 
Belongs to package Box Do not include directly, include til/Box.h instead.
Definition: Accumulator.h:10
A type representing the absence of a type.
Definition: til_common.h:82
unsigned short ushort
Definition: til_common.h:76
A type used in some construtors to disable initialization.
Definition: til_common.h:85
void warning(const char *msg)
Library warning.
Definition: til_common.h:79
const NoInit no_init
Definition: til_common.h:86
unsigned char uchar
Definition: til_common.h:75