Image Component Library (ICL)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Namespaces | Defines | 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

namespace  icl
 

The ICL-namespace.


namespace  icl::utils

Defines

#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)
#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)
#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)
template<class T , unsigned int N>
static T icl::utils::power (const T &x)
 power template

Define Documentation

#define DEBUG_LOG (   x)    DEBUG_LOG0(x)
#define DEBUG_LOG0 (   x)    { std::cerr << "[" __FILE__ ":" << __FUNCTION__ << ",line: " << __LINE__ << "] " << x << std::endl; }
#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 DEBUGLEVEL_1
#define ERROR_LOG (   x)    DEBUG_LOG0("ERROR: " << x);

critical log messages, that may cause application failure

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

notification of function calls

#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))
Value:
ICL_INSTANTIATE_ALL_INT_DEPTHS \
    ICL_INSTANTIATE_ALL_FLOAT_DEPTHS
Value:
ICL_INSTANTIATE_ALL_SECOND_DEPTHS(8u) \
    ICL_INSTANTIATE_ALL_SECOND_DEPTHS(16s) \
    ICL_INSTANTIATE_ALL_SECOND_DEPTHS(32s) \
    ICL_INSTANTIATE_ALL_SECOND_DEPTHS(32f) \
    ICL_INSTANTIATE_ALL_SECOND_DEPTHS(64f)
Value:
ICL_INSTANTIATE_DEPTH(32f) \
    ICL_INSTANTIATE_DEPTH(64f)
Value:
ICL_INSTANTIATE_DEPTH(8u)  \
    ICL_INSTANTIATE_DEPTH(16s) \
    ICL_INSTANTIATE_DEPTH(32s)
Value:
ICL_INSTANTIATE_DEPTH(D, 8u)  \
    ICL_INSTANTIATE_DEPTH(D, 16s) \
    ICL_INSTANTIATE_DEPTH(D, 32s) \
    ICL_INSTANTIATE_DEPTH(D, 32f) \
    ICL_INSTANTIATE_DEPTH(D, 64f)
#define ICL_UNLIKELY (   expr)    expr
#define ICLASSERT (   X)
Value:
if(!(X)){                                 \
      ERROR_LOG("ICL ASSERTION ERROR:" << #X) \
    }

generate an assertion error if condition evaluates false

#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

#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

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

generate the given exception if the condition evaluates false

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

Utility macros and defines

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

uncritical log messages, for global information

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

log messages in long loops like pixel ops

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

notification of code sections

#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)

#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)

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

notification of code subsections

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

also critical log messages things that must still be done

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

uncritical log messages, that may cause calculation errors

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines