50 #if (defined(DEBUGLEVEL_0) ||defined(DEBUGLEVEL_1) || defined(DEBUGLEVEL_2) || defined (DEBUGLEVEL_3) || defined(DEBUGLEVEL_4) || defined(DEBUGLEVEL_5)) 51 #define DEBUG_LOG0(x) \ 52 { std::cerr << "[" __FILE__ ":" << __FUNCTION__ << ",line: " << __LINE__ << "] " << x << std::endl; } 55 #endif // DEBUGLEVEL 0 57 #define DEBUG_LOG(x) DEBUG_LOG0(x) 60 #if (defined(DEBUGLEVEL_1) || defined(DEBUGLEVEL_2) || defined (DEBUGLEVEL_3) || defined(DEBUGLEVEL_4) || defined(DEBUGLEVEL_5)) 61 #define DEBUG_LOG1(x) \ 62 { std::cerr << "[" __FILE__ ":" << __FUNCTION__ << ",line: " << __LINE__ << "] " << x << std::endl; } 65 #endif // DEBUGLEVEL 1 68 #if (defined(DEBUGLEVEL_2) || defined(DEBUGLEVEL_3) || defined(DEBUGLEVEL_4) || defined(DEBUGLEVEL_5)) 69 #define DEBUG_LOG2(x) \ 70 { std::cerr << "[" __FILE__ ":" << __FUNCTION__ << ",line: " << __LINE__ << "] " << x << std::endl; } 73 #endif // DEBUGLEVEL 2 76 #if (defined(DEBUGLEVEL_3) || defined(DEBUGLEVEL_4) || defined(DEBUGLEVEL_5)) 77 #define DEBUG_LOG3(x) \ 78 { std::cerr << "[" __FILE__ ":" << __FUNCTION__ << ",line: " << __LINE__ << "] " << x << std::endl; } 81 #endif // DEBUGLEVEL 3 84 #if (defined(DEBUGLEVEL_4) || defined(DEBUGLEVEL_5)) 85 #define DEBUG_LOG4(x) \ 86 { std::cerr << "[" __FILE__ ":" << __FUNCTION__ << ",line: " << __LINE__ << "] " << x << std::endl; } 89 #endif // DEBUGLEVEL 4 92 #if (defined(DEBUGLEVEL_5)) 93 #define DEBUG_LOG5(x) \ 94 { std::cerr << "[" __FILE__ ":" << __FUNCTION__ << ",line: " << __LINE__ << "] " << x << std::endl; } 97 #endif // DEBUGLEVEL 5 103 { std::cout << "[" __FILE__ ":" << __FUNCTION__ << ",line: " << __LINE__ << "] " << (#X) << ":\n" << X << std::endl; } 107 { std::cout << (#X) << ":\n" << X << std::endl; } 111 #define ERROR_LOG(x) DEBUG_LOG0("ERROR: " << x); 114 #define TODO_LOG(x) DEBUG_LOG0("TODO: " << x); 117 #define WARNING_LOG(x) DEBUG_LOG1("WARNING: " << x); 120 #define INFO_LOG(x) DEBUG_LOG1("INFO: " << x); 123 #define FUNCTION_LOG(x) DEBUG_LOG2("FUNCTION: " << x); 126 #define SECTION_LOG(x) DEBUG_LOG3("SECTION: " << x); 129 #define SUBSECTION_LOG(x) DEBUG_LOG4("SUBSECTION: " << x); 132 #define LOOP_LOG(x) DEBUG_LOG5("LOOP: " << x); 135 #define ICLASSERT(X) \ 137 ERROR_LOG("ICL ASSERTION ERROR:" << #X) \ 141 #define ICLASSERT_RETURN(X) \ 143 ERROR_LOG("ICL ASSERTION ERROR:" << #X << "(returning!)"); \ 148 #define ICLASSERT_RETURN_VAL(X,VALUE) \ 150 ERROR_LOG("ICL ASSERTION ERROR:" << #X << "(returning!)"); \ 155 #define ICLASSERT_THROW(X,OBJ) \ 160 #if (defined __GNUC__ && __GNUC__ >= 3) 161 #define ICL_UNLIKELY(expr) __builtin_expect(expr, 0) 163 #define ICL_UNLIKELY(expr) expr 166 #define ICL_INSTANTIATE_ALL_INT_DEPTHS \ 167 ICL_INSTANTIATE_DEPTH(8u) \ 168 ICL_INSTANTIATE_DEPTH(16s) \ 169 ICL_INSTANTIATE_DEPTH(32s) 171 #define ICL_INSTANTIATE_ALL_FLOAT_DEPTHS \ 172 ICL_INSTANTIATE_DEPTH(32f) \ 173 ICL_INSTANTIATE_DEPTH(64f) 175 #define ICL_INSTANTIATE_ALL_DEPTHS \ 176 ICL_INSTANTIATE_ALL_INT_DEPTHS \ 177 ICL_INSTANTIATE_ALL_FLOAT_DEPTHS 180 #define ICL_INSTANTIATE_ALL_SECOND_DEPTHS(D) \ 181 ICL_INSTANTIATE_DEPTH(D, 8u) \ 182 ICL_INSTANTIATE_DEPTH(D, 16s) \ 183 ICL_INSTANTIATE_DEPTH(D, 32s) \ 184 ICL_INSTANTIATE_DEPTH(D, 32f) \ 185 ICL_INSTANTIATE_DEPTH(D, 64f) 187 #define ICL_INSTANTIATE_ALL_DEPTHS_2 \ 188 ICL_INSTANTIATE_ALL_SECOND_DEPTHS(8u) \ 189 ICL_INSTANTIATE_ALL_SECOND_DEPTHS(16s) \ 190 ICL_INSTANTIATE_ALL_SECOND_DEPTHS(32s) \ 191 ICL_INSTANTIATE_ALL_SECOND_DEPTHS(32f) \ 192 ICL_INSTANTIATE_ALL_SECOND_DEPTHS(64f) 199 #define iclMin(A,B) std::min(A,B) 200 #define iclMax(A,B) std::max(A,B) 204 #define iclMin(A,B) ((A)<(B)?(A):(B)) 207 #define iclMax(A,B) ((A)>(B)?(A):(B)) 212 template<
class T>
static inline T
sqr(
const T &x) {
return x*x; }
215 template<
class T,
unsigned int N>
static inline T
power(
const T&x){
219 case 2:
return sqr(x);
220 case 3:
return sqr(x)*x;
221 case 4:
return sqr(
sqr(x));
222 case 5:
return sqr(
sqr(x))*x;
224 return ::pow(x,(
int)N);
242 #define ICL_DELETE(X) if((X)){ delete (X); (X)=0; } 244 #define ICL_DELETE_ARRAY(X) if((X)){ delete [] (X); (X)=0; } 247 #define ICL_DEPRECATED __declspec(deprecated) 249 #define ICL_DEPRECATED __attribute__((deprecated)) undocument this line if you encounter any issues!
Definition: Any.h:37
static T power(const T &x)
power template
Definition: Macros.h:215
static T sqr(const T &x)
square template (faster than pow(x,2)
Definition: Macros.h:212