TBCI Numerical high perf. C++ Library  2.8.0
tbci_param.h
Go to the documentation of this file.
1 
55 #include "tbci/basics.h"
56 
57 #ifndef _TBCI_PARAM_H
58 #define _TBCI_PARAM_H
59 
61 
62 #define _TBCI_FLAG_ERRCHECK 1
63 #define _TBCI_FLAG_EXPCHECK 2
64 #define _TBCI_FLAG_ABORT 4
65 #define _TBCI_FLAG_EXCEPT 8
66 #define _TBCI_FLAG_EXACTSUM 16
67 #define _TBCI_FLAG_EXACTSUM2 32
68 
69 #define _TBCI_CWD_DEFAULT (_TBCI_FLAG_ERRCHECK | _TBCI_FLAG_EXPCHECK | _TBCI_FLAG_EXCEPT)
70 
71 #if 0
72 
91 template <unsigned ctr>
92 class tbci_par
93 {
94  public:
95  unsigned int cwd;
96  tbci_par() : cwd(_TBCI_CWD_DEFAULT) {};
97 };
98 
99 /* Singleton */
100 template <unsigned ctr>
101 inline unsigned int& tbci_params()
102 {
103  static tbci_par<ctr> settings;
104  return settings.cwd;
105 }
106 #define GET_T_CWD tbci_params<0>()
107 #else
108 extern unsigned int tbci_control;
109 #define GET_T_CWD tbci_control
110 #endif
111 
112 #define CWD_CTRL_FCTS(NAME, FLAG) \
113 void inline set_##NAME(bool val) \
114 { \
115  unsigned int& cwd = GET_T_CWD; \
116  if (val) \
117  cwd |= FLAG; \
118  else \
119  cwd &= ~(FLAG); \
120 }; \
121 inline unsigned int do_##NAME() \
122 { \
123  const unsigned int cwd = GET_T_CWD; \
124  return cwd & FLAG; \
125 }
126 
127 #define CWD_CTRL_DISABLED(NAME) \
128 void inline set_##NAME(bool val) \
129 { \
130  if (val) \
131  fprintf(stderr, "TBCI warning: Attempt to set " #NAME ", which is disabled.\n"); \
132 }; \
133 inline unsigned int do_##NAME() \
134 { \
135  return 0; \
136 }
137 
138 #ifdef TBCI_NO_ERRCHECK
139 CWD_CTRL_DISABLED(errcheck);
140 #else
142 #endif
143 #ifndef TBCI_EXPCHECK
145 #else
147 #endif
152 
154 #endif
155 
#define _TBCI_CWD_DEFAULT
Definition: tbci_param.h:69
unsigned int tbci_control
#define NAMESPACE_TBCI
Definition: basics.h:317
#define _TBCI_FLAG_EXACTSUM
Definition: tbci_param.h:66
#define _TBCI_FLAG_EXPCHECK
Definition: tbci_param.h:63
#define CWD_CTRL_FCTS(NAME, FLAG)
Definition: tbci_param.h:112
#define _TBCI_FLAG_EXCEPT
Definition: tbci_param.h:65
#define _TBCI_FLAG_ERRCHECK
Definition: tbci_param.h:62
#define _TBCI_FLAG_EXACTSUM2
Definition: tbci_param.h:67
#define CWD_CTRL_DISABLED(NAME)
Definition: tbci_param.h:127
#define _TBCI_FLAG_ABORT
Definition: tbci_param.h:64
#define NAMESPACE_END
Definition: basics.h:323