Image Component Library (ICL)
Namespaces | Macros | Functions
Macros.h File Reference
#include <ICLUtils/CompatMacros.h>
#include <ICLUtils/BasicTypes.h>
#include <iostream>
#include <stdlib.h>
#include <cmath>

Go to the source code of this file.

Namespaces

 icl
 undocument this line if you encounter any issues!
 
 icl::utils
 

Macros

#define DEBUGLEVEL_1
 
#define DEBUG_LOG0(x)   { std::cerr << "[" __FILE__ ":" << __FUNCTION__ << ",line: " << __LINE__ << "] " << x << std::endl; }
 
#define DEBUG_LOG(x)   DEBUG_LOG0(x)
 
#define DEBUG_LOG1(x)   { std::cerr << "[" __FILE__ ":" << __FUNCTION__ << ",line: " << __LINE__ << "] " << x << std::endl; }
 
#define DEBUG_LOG2(x)
 
#define DEBUG_LOG3(x)
 
#define DEBUG_LOG4(x)
 
#define DEBUG_LOG5(x)
 
#define SHOWX(X)   { std::cout << "[" __FILE__ ":" << __FUNCTION__ << ",line: " << __LINE__ << "] " << (#X) << ":\n" << X << std::endl; }
 Extended show command. Shows name and value of streamed variables on std::cout (with trailing file,function and line info) More...
 
#define SHOW(X)   { std::cout << (#X) << ":\n" << X << std::endl; }
 Simple show command. Shows name and value of streamed variables on std::cout (without trailing file,function and line info) More...
 
#define ERROR_LOG(x)   DEBUG_LOG0("ERROR: " << x);
 
#define TODO_LOG(x)   DEBUG_LOG0("TODO: " << x);
 
#define WARNING_LOG(x)   DEBUG_LOG1("WARNING: " << x);
 
#define INFO_LOG(x)   DEBUG_LOG1("INFO: " << x);
 
#define FUNCTION_LOG(x)   DEBUG_LOG2("FUNCTION: " << x);
 
#define SECTION_LOG(x)   DEBUG_LOG3("SECTION: " << x);
 
#define SUBSECTION_LOG(x)   DEBUG_LOG4("SUBSECTION: " << x);
 
#define LOOP_LOG(x)   DEBUG_LOG5("LOOP: " << x);
 
#define ICLASSERT(X)
 
#define ICLASSERT_RETURN(X)
 
#define ICLASSERT_RETURN_VAL(X, VALUE)
 
#define ICLASSERT_THROW(X, OBJ)
 
#define ICL_UNLIKELY(expr)   expr
 
#define ICL_INSTANTIATE_ALL_INT_DEPTHS
 
#define ICL_INSTANTIATE_ALL_FLOAT_DEPTHS
 
#define ICL_INSTANTIATE_ALL_DEPTHS
 
#define ICL_INSTANTIATE_ALL_SECOND_DEPTHS(D)
 
#define ICL_INSTANTIATE_ALL_DEPTHS_2
 
#define iclMin(A, B)   ((A)<(B)?(A):(B))
 
#define iclMax(A, B)   ((A)>(B)?(A):(B))
 
#define ICL_DELETE(X)   if((X)){ delete (X); (X)=0; }
 
#define ICL_DELETE_ARRAY(X)   if((X)){ delete [] (X); (X)=0; }
 
#define ICL_DEPRECATED   __attribute__((deprecated))
 

Functions

template<class T >
static T icl::utils::sqr (const T &x)
 square template (faster than pow(x,2) More...
 
template<class T , unsigned int N>
static T icl::utils::power (const T &x)
 power template More...
 

Macro Definition Documentation

◆ DEBUG_LOG

#define DEBUG_LOG (   x)    DEBUG_LOG0(x)

◆ DEBUG_LOG0

#define DEBUG_LOG0 (   x)    { std::cerr << "[" __FILE__ ":" << __FUNCTION__ << ",line: " << __LINE__ << "] " << x << std::endl; }

◆ DEBUG_LOG1

#define DEBUG_LOG1 (   x)    { std::cerr << "[" __FILE__ ":" << __FUNCTION__ << ",line: " << __LINE__ << "] " << x << std::endl; }

◆ DEBUG_LOG2

#define DEBUG_LOG2 (   x)

◆ DEBUG_LOG3

#define DEBUG_LOG3 (   x)

◆ DEBUG_LOG4

#define DEBUG_LOG4 (   x)

◆ DEBUG_LOG5

#define DEBUG_LOG5 (   x)

◆ DEBUGLEVEL_1

#define DEBUGLEVEL_1

◆ ERROR_LOG

#define ERROR_LOG (   x)    DEBUG_LOG0("ERROR: " << x);

critical log messages, that may cause application failure

◆ FUNCTION_LOG

#define FUNCTION_LOG (   x)    DEBUG_LOG2("FUNCTION: " << x);

notification of function calls

◆ ICL_DELETE

#define ICL_DELETE (   X)    if((X)){ delete (X); (X)=0; }

◆ ICL_DELETE_ARRAY

#define ICL_DELETE_ARRAY (   X)    if((X)){ delete [] (X); (X)=0; }

◆ ICL_DEPRECATED

#define ICL_DEPRECATED   __attribute__((deprecated))

◆ ICL_INSTANTIATE_ALL_DEPTHS

#define ICL_INSTANTIATE_ALL_DEPTHS
Value:
ICL_INSTANTIATE_ALL_INT_DEPTHS \
ICL_INSTANTIATE_ALL_FLOAT_DEPTHS

◆ ICL_INSTANTIATE_ALL_DEPTHS_2

#define ICL_INSTANTIATE_ALL_DEPTHS_2
Value:
ICL_INSTANTIATE_ALL_SECOND_DEPTHS(16s) \
ICL_INSTANTIATE_ALL_SECOND_DEPTHS(32s) \
ICL_INSTANTIATE_ALL_SECOND_DEPTHS(32f) \
ICL_INSTANTIATE_ALL_SECOND_DEPTHS(64f)
#define ICL_INSTANTIATE_ALL_SECOND_DEPTHS(D)
Definition: Macros.h:180

◆ ICL_INSTANTIATE_ALL_FLOAT_DEPTHS

#define ICL_INSTANTIATE_ALL_FLOAT_DEPTHS
Value:
ICL_INSTANTIATE_DEPTH(64f)
#define ICL_INSTANTIATE_DEPTH(D)
Definition: Range.h:129

◆ ICL_INSTANTIATE_ALL_INT_DEPTHS

#define ICL_INSTANTIATE_ALL_INT_DEPTHS
Value:
ICL_INSTANTIATE_DEPTH(16s) \
ICL_INSTANTIATE_DEPTH(32s)
#define ICL_INSTANTIATE_DEPTH(D)
Definition: Range.h:129

◆ ICL_INSTANTIATE_ALL_SECOND_DEPTHS

#define ICL_INSTANTIATE_ALL_SECOND_DEPTHS (   D)
Value:
ICL_INSTANTIATE_DEPTH(D, 16s) \
ICL_INSTANTIATE_DEPTH(D, 32s) \
ICL_INSTANTIATE_DEPTH(D, 32f) \
ICL_INSTANTIATE_DEPTH(D, 64f)
#define ICL_INSTANTIATE_DEPTH(D)
Definition: Range.h:129

◆ ICL_UNLIKELY

#define ICL_UNLIKELY (   expr)    expr

◆ ICLASSERT

#define ICLASSERT (   X)
Value:
if(!(X)){ \
ERROR_LOG("ICL ASSERTION ERROR:" << #X) \
}

generate an assertion error if condition evaluates false

◆ ICLASSERT_RETURN

#define ICLASSERT_RETURN (   X)
Value:
if(!(X)){ \
ERROR_LOG("ICL ASSERTION ERROR:" << #X << "(returning!)"); \
return; \
}

generate an assertion error and return (from void function) if condition evaluates false

◆ ICLASSERT_RETURN_VAL

#define ICLASSERT_RETURN_VAL (   X,
  VALUE 
)
Value:
if(!(X)){ \
ERROR_LOG("ICL ASSERTION ERROR:" << #X << "(returning!)"); \
return VALUE; \
}

generate an assertion error and return with value if condition evaluates false

◆ ICLASSERT_THROW

#define ICLASSERT_THROW (   X,
  OBJ 
)
Value:
if(!(X)){ \
throw OBJ; \
}

generate the given exception if the condition evaluates false

◆ iclMax

#define iclMax (   A,
 
)    ((A)>(B)?(A):(B))

◆ iclMin

#define iclMin (   A,
 
)    ((A)<(B)?(A):(B))

Utility macros and defines

◆ INFO_LOG

#define INFO_LOG (   x)    DEBUG_LOG1("INFO: " << x);

uncritical log messages, for global information

◆ LOOP_LOG

#define LOOP_LOG (   x)    DEBUG_LOG5("LOOP: " << x);

log messages in long loops like pixel ops

◆ SECTION_LOG

#define SECTION_LOG (   x)    DEBUG_LOG3("SECTION: " << x);

notification of code sections

◆ SHOW

#define SHOW (   X)    { std::cout << (#X) << ":\n" << X << std::endl; }

Simple show command. Shows name and value of streamed variables on std::cout (without trailing file,function and line info)

◆ SHOWX

#define SHOWX (   X)    { std::cout << "[" __FILE__ ":" << __FUNCTION__ << ",line: " << __LINE__ << "] " << (#X) << ":\n" << X << std::endl; }

Extended show command. Shows name and value of streamed variables on std::cout (with trailing file,function and line info)

◆ SUBSECTION_LOG

#define SUBSECTION_LOG (   x)    DEBUG_LOG4("SUBSECTION: " << x);

notification of code subsections

◆ TODO_LOG

#define TODO_LOG (   x)    DEBUG_LOG0("TODO: " << x);

also critical log messages things that must still be done

◆ WARNING_LOG

#define WARNING_LOG (   x)    DEBUG_LOG1("WARNING: " << x);

uncritical log messages, that may cause calculation errors