Main Page | Data Structures | File List | Data Fields | Globals | Related Pages

kerror.h File Reference

Errors system functions. More...

#include "ktypes.h"
#include "kmath.h"

Defines

#define k_assert(condition)   k_assert_info (condition, knull, __K_FILE__, __K_LINE__)
 Stops execution of code if condition is false in debug mode and prints a message, the file name and the line number where the execution is stopped This does nothing in release mode.
#define k_assert_msg(condition, msg)   k_assert_info (condition, msg, __K_FILE__, __K_LINE__)
 Stops execution of code if condition is false in debug mode and prints a message, the file name and the line number where the execution is stopped This does nothing in release mode.
#define k_error   k_error_print (__K_FILE__, __K_LINE__, __K_FUNCTION__)
 Prints an error message specifying the file name, the line number and the function name where the error occurred.
#define k_error_bool   _k_error_bool (__K_FILE__, __K_LINE__, __K_FUNCTION__)
 Prints an error message specifying the file name, the line number and the function name where the error occurred Calls the k_error_print function.
#define k_error_kint   _k_error_kint (__K_FILE__, __K_LINE__, __K_FUNCTION__)
 Prints an error message specifying the file name, the line number and the function name where the error occurred Calls the k_error_print function.
#define k_error_null   _k_error_null (__K_FILE__, __K_LINE__, __K_FUNCTION__)
 Prints an error message specifying the file name, the line number and the function name where the error occurred Calls the k_error_print function.
#define k_error_void   {k_error_print (__K_FILE__, __K_LINE__, __K_FUNCTION__); return;}
 Prints an error message specifying the file name, the line number and the function name where the error occurred Calls the k_error_print function see k_error_print function.
#define k_check_equal(v1, v2)   if ((v1) != (v2)) return k_error_bool;
 Checks if the two given parameters are equal if(v1==v2) continue execution else returns kfalse.
#define k_check_equal_d(v1, v2, e)   if (k_fabs ((v1) - (v2)) > (e)) return k_error_bool;
 Checks if the two given parameters are equal regarding an epsilon value if((v1-v2)<=e) continues execution else returns kfalse.
#define k_check_notequal(v1, v2)   if ((v1) == (v2)) return k_error_bool;
 Checks if the two given parameters are not equal if(v1!=v2) continues execution else returns kfalse.
#define k_check_notequal_d(v1, v2, e)   if (k_fabs ((v1) - (v2)) < (e)) return k_error_bool;
 Checks if the two given parameters are not equal regarding an epsilon value if((v1-v2)>=e) continues execution else returns kfalse.
#define k_check_less(v1, v2)   if ((v1) >= (v2)) return k_error_bool;
 Checks if the first parameter is less than the second one if(v1<v2) continues execution else returns kfalse.
#define k_check_lesseq(v1, v2)   if ((v1) > (v2)) return k_error_bool;
 Checks if the first parameter is less or equal than the second one if(v1<=v2) continues execution else returns kfalse.
#define k_check(b)   if (!(b)) return k_error_bool;
 Checks if the condition parameter is true if(b) continues execution else returns kfalse.
#define k_notnull(b)   k_check (knull != (b))
 Checks if the condition parameter is not null if(b!=knull) continues execution else returns kfalse.
#define k_critical(bCond)   k_critical_f (bCond, __K_FILE__, __K_LINE__)
 Stops the execution if the condition parameter is not true Displays an error message specifying the file name and the line number where this function is called.
#define k_critical_int(bCond)
 Stops the execution if the condition parameter is not true Displays an error message specifying the file name and the line number where this function is called.
#define k_critical_void(bCond)
 Stops the execution if the condition parameter is not true Displays an error message specifying the file name and the line number where this function is called.
#define k_critical_null(bCond)
 Stops the execution if the condition parameter is not true Displays an error message specifying the file name and the line number where this function is called.
#define k_critical_bool(bCond)
 Stops the execution if the condition parameter is not true Displays an error message specifying the file name and the line number where this function is called.
#define k_critical_comment(bCond, sComment)   k_critical_comment_f(bCond, __K_FILE__, __K_LINE__, sComment)
 Stops the execution if the condition parameter is not true Displays an error message specifying the file name and the line number where this function is called and a comment concerning the critical situation.

Functions

KTL_API void k_error_disable_assert ()
 Disables the asserts execution This does nothing in release mode.
KTL_API void k_error_enable_assert ()
 Enables the asserts execution This does nothing in release mode.
KTL_API void k_error_disable_print ()
 Disables the display of error in stdout This does nothing in release mode.
KTL_API void k_error_enable_print ()
 Enables the display of error in stdout This does nothing in release mode.
KTL_API void k_assert_info (KBool condition, KString sMsg, KString sFile, KInt32 iLine)
 Stops execution of code if condition is false in debug mode and prints a message, the file name and the line number where the execution is stopped This does nothing in release mode.
KTL_API void k_error_print (KString file, KInt32 line, KString func)
 Prints an error message specifying the file name, the line number and the function name where the error occurred.
KTL_API KBool _k_error_bool (KString file, KInt32 line, KString func)
 Prints an error message specifying the file name, the line number and the function name where the error occurred Calls the k_error_print function Used by the k_error_bool macro.
KTL_API KInt _k_error_kint (KString file, KInt32 line, KString func)
 Prints an error message specifying the file name, the line number and the function name where the error occurred Calls the k_error_print function Used by the k_error_kint macro.
KTL_API KPtr _k_error_null (KString file, KInt32 line, KString func)
 Prints an error message specifying the file name, the line number and the function name where the error occurred Calls the k_error_print function Used with k_error_null macro.
KTL_API void k_critical_init (KFunc_critical_action *fAction)
 Initializes the critical.
KTL_API KBool k_critical_f (KBool bCond, KString sFile, KUInt32 iLine)
 Stops the execution if the condition parameter is not true Displays an error message specifying the file name and the line number where this function is called.
KTL_API KBool k_critical_comment_f (KBool bCond, KString sFile, KUInt32 iLine, KString sComment)
 Stops the execution if the condition parameter is not true Displays an error message specifying the file name and the line number where this function is called and a comment concerning the critical situation.


Detailed Description

Errors system functions.

Version:
KToolLib-1.0
Author:
Fabien Gallot
Date:
18/03/2009
Note:
Copyright © 2008-2010 iKlax Media SAS (www.iklaxmedia.com). All rights reserved.

Define Documentation

#define k_assert condition   )     k_assert_info (condition, knull, __K_FILE__, __K_LINE__)
 

Stops execution of code if condition is false in debug mode and prints a message, the file name and the line number where the execution is stopped This does nothing in release mode.

Parameters:
condition the condition which triggers stop of the execution

#define k_assert_msg condition,
msg   )     k_assert_info (condition, msg, __K_FILE__, __K_LINE__)
 

Stops execution of code if condition is false in debug mode and prints a message, the file name and the line number where the execution is stopped This does nothing in release mode.

Parameters:
condition the condition which triggers stop of the execution
msg the message to be displayed at the stop of the execution

#define k_check  )     if (!(b)) return k_error_bool;
 

Checks if the condition parameter is true if(b) continues execution else returns kfalse.

Returns:
ktrue if(b) otherwise kfalse

#define k_check_equal v1,
v2   )     if ((v1) != (v2)) return k_error_bool;
 

Checks if the two given parameters are equal if(v1==v2) continue execution else returns kfalse.

Returns:
ktrue if v1 and v2 are equal otherwise kfalse

#define k_check_equal_d v1,
v2,
 )     if (k_fabs ((v1) - (v2)) > (e)) return k_error_bool;
 

Checks if the two given parameters are equal regarding an epsilon value if((v1-v2)<=e) continues execution else returns kfalse.

Returns:
ktrue if((v1-v2)<=e) otherwise kfalse

#define k_check_less v1,
v2   )     if ((v1) >= (v2)) return k_error_bool;
 

Checks if the first parameter is less than the second one if(v1<v2) continues execution else returns kfalse.

Returns:
ktrue if(v1<v2) otherwise kfalse

#define k_check_lesseq v1,
v2   )     if ((v1) > (v2)) return k_error_bool;
 

Checks if the first parameter is less or equal than the second one if(v1<=v2) continues execution else returns kfalse.

Returns:
ktrue if(v1<=v2) otherwise kfalse

#define k_check_notequal v1,
v2   )     if ((v1) == (v2)) return k_error_bool;
 

Checks if the two given parameters are not equal if(v1!=v2) continues execution else returns kfalse.

Returns:
ktrue if(v1!=v2) otherwise kfalse

#define k_check_notequal_d v1,
v2,
 )     if (k_fabs ((v1) - (v2)) < (e)) return k_error_bool;
 

Checks if the two given parameters are not equal regarding an epsilon value if((v1-v2)>=e) continues execution else returns kfalse.

Returns:
ktrue if((v1-v2)>=e) otherwise kfalse

#define k_critical bCond   )     k_critical_f (bCond, __K_FILE__, __K_LINE__)
 

Stops the execution if the condition parameter is not true Displays an error message specifying the file name and the line number where this function is called.

Parameters:
bCond the condition to be evaluated
Returns:
ktrue if the condition is true otherwise kfalse

#define k_critical_bool bCond   ) 
 

Value:

if (!k_critical (bCond)) { \ return kfalse; \ }
Stops the execution if the condition parameter is not true Displays an error message specifying the file name and the line number where this function is called.

Parameters:
bCond the condition to be evaluated
Returns:
kfalse if the condition is false

#define k_critical_comment bCond,
sComment   )     k_critical_comment_f(bCond, __K_FILE__, __K_LINE__, sComment)
 

Stops the execution if the condition parameter is not true Displays an error message specifying the file name and the line number where this function is called and a comment concerning the critical situation.

Parameters:
bCond the condition to be evaluated
sComment the comment to be displayed if the condition is not true
Returns:
ktrue if the condition is true otherwise kfalse

#define k_critical_int bCond   ) 
 

Value:

if (!k_critical (bCond)) { \ return -1; \ }
Stops the execution if the condition parameter is not true Displays an error message specifying the file name and the line number where this function is called.

Parameters:
bCond the condition to be evaluated
Returns:
-1 if the condition is false

#define k_critical_null bCond   ) 
 

Value:

if (!k_critical (bCond)) { \ return knull; \ }
Stops the execution if the condition parameter is not true Displays an error message specifying the file name and the line number where this function is called.

Parameters:
bCond the condition to be evaluated
Returns:
knull if the condition is false

#define k_critical_void bCond   ) 
 

Value:

if (!k_critical (bCond)) { \ return; \ }
Stops the execution if the condition parameter is not true Displays an error message specifying the file name and the line number where this function is called.

Parameters:
bCond the condition to be evaluated

#define k_error_bool   _k_error_bool (__K_FILE__, __K_LINE__, __K_FUNCTION__)
 

Prints an error message specifying the file name, the line number and the function name where the error occurred Calls the k_error_print function.

Returns:
kfalse

#define k_error_kint   _k_error_kint (__K_FILE__, __K_LINE__, __K_FUNCTION__)
 

Prints an error message specifying the file name, the line number and the function name where the error occurred Calls the k_error_print function.

Returns:
-1

#define k_error_null   _k_error_null (__K_FILE__, __K_LINE__, __K_FUNCTION__)
 

Prints an error message specifying the file name, the line number and the function name where the error occurred Calls the k_error_print function.

Returns:
knull

#define k_notnull  )     k_check (knull != (b))
 

Checks if the condition parameter is not null if(b!=knull) continues execution else returns kfalse.

Returns:
ktrue if(b!=knull) otherwise kfalse


Function Documentation

KTL_API KBool _k_error_bool KString  file,
KInt32  line,
KString  func
 

Prints an error message specifying the file name, the line number and the function name where the error occurred Calls the k_error_print function Used by the k_error_bool macro.

Parameters:
file the file name where the error occurred
line the line number where the error occurred
func the function name where the error occurred
Returns:
kfalse

KTL_API KInt _k_error_kint KString  file,
KInt32  line,
KString  func
 

Prints an error message specifying the file name, the line number and the function name where the error occurred Calls the k_error_print function Used by the k_error_kint macro.

Parameters:
file the file name where the error occurred
line the line number where the error occurred
func the function name where the error occurred
Returns:
-1

KTL_API KPtr _k_error_null KString  file,
KInt32  line,
KString  func
 

Prints an error message specifying the file name, the line number and the function name where the error occurred Calls the k_error_print function Used with k_error_null macro.

Parameters:
file the file name where the error occurred
line the line number where the error occurred
func the function name where the error occurred
Returns:
knull

KTL_API void k_assert_info KBool  condition,
KString  sMsg,
KString  sFile,
KInt32  iLine
 

Stops execution of code if condition is false in debug mode and prints a message, the file name and the line number where the execution is stopped This does nothing in release mode.

Parameters:
condition the condition which triggers stop of the execution
sMsg the message to be displayed at the stop of the execution
sFile the name of the file where the execution stopped
iLine the line number where the execution stopped

KTL_API KBool k_critical_comment_f KBool  bCond,
KString  sFile,
KUInt32  iLine,
KString  sComment
 

Stops the execution if the condition parameter is not true Displays an error message specifying the file name and the line number where this function is called and a comment concerning the critical situation.

Parameters:
bCond the condition to be evaluated
sFile the file name where this function is called
iLine the line number where this function is called
sComment the comment to be displayed if the condition is not true
Returns:
ktrue if the condition is true otherwise kfalse

KTL_API KBool k_critical_f KBool  bCond,
KString  sFile,
KUInt32  iLine
 

Stops the execution if the condition parameter is not true Displays an error message specifying the file name and the line number where this function is called.

Parameters:
bCond the condition to be evaluated
sFile the file name where this function is called
iLine the line number where this function is called
Returns:
ktrue if the condition is true otherwise kfalse

KTL_API void k_critical_init KFunc_critical_action *  fAction  ) 
 

Initializes the critical.

Parameters:
fAction the critical action

KTL_API void k_error_print KString  file,
KInt32  line,
KString  func
 

Prints an error message specifying the file name, the line number and the function name where the error occurred.

Parameters:
file the file name where the error occurred
line the line number where the error occurred
func the function name where the error occurred


Generated on Tue Mar 9 10:49:29 2010 for iKlax Tools Library (KToolLib) by doxygen 1.3.8