TLIB documentation
 

tlError.h File Reference


Detailed Description

Thread-safe error management.

Error management

TLIB uses a thread-safe global, tl_errno, to store the last error that occured in the thread currently executing. Most functions and methods will return either 0 or a valid, positive value on success, and -1 (or NULL) in case of failure. On failure, programmers can check the value of tl_errno against the error values.

To help identify the errror, the tlError() functions return a string that describes the error. If tl_set_verbose() is enabled, TLIB will spontaneously produce error messages to the standard output as they occur.

An important feature of the TLIB error management is its ability to detect errors in constructors/destructors. Every constructor and destructore of TLIB classes sets the tl_errno global to TL_NO_ERROR on success, or an error value otherwise.

#include "tlVision.h"

Include dependency graph for tlError.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define TL_ERRNO_MSG(msg, errno)   { (tl_errno = errno); if (tlVerbose > 0) {tlError (msg); }}

Enumerations

enum  tl_errors {
  TL_NO_ERROR, TL_ERROR, TL_ERROR_INVALID_FORMAT, TL_ERROR_GEOMETRY,
  TL_ERROR_NULL_POINTER, TL_ERROR_INDEX_OUT_OF_BOUNDS, TL_ERROR_MAX_REACHED, TL_ERROR_ALLOCATION_FAILED,
  TL_ERROR_NOT_IMPLEMENTED, TL_ERROR_FILE_IO, TL_ERROR_FILE_NOT_FOUND_OR_CORRUPT, TL_ERROR_NOT_REQUIRED,
  TL_ERROR_NOT_FOUND, TL_ERROR_NOT_AVAILABLE, TL_ERROR_NOT_IN_IMAGE, TL_ERROR_STACK_OVERFLOW,
  TL_ERROR_TIMEOUT, TL_ERROR_THREAD, TL_ERROR_TIMER, TL_ERROR_RESOURCE_NOT_AVAILABLE,
  TL_ERROR_CONFIG_FAILED, TL_ERROR_GRAB_FAILED , TL_ERROR_NA
}

Functions

int * tl_errno_location ()
 Function that returns the address of the tl_errno variable.
void tl_errno_destructor (void *)
 errno dectructor
void tl_errno_once ()
 errno initializer
void tlError ()
void tlError (const char *str)
void tlError (int errno)
void tlError (int errno, const char *str)


Define Documentation

#define TL_ERRNO_MSG ( msg,
errno   )     { (tl_errno = errno); if (tlVerbose > 0) {tlError (msg); }}

Sets the tl_errno global and displays an error message to the standard output if tl_set_verbose() is enabled.


Enumeration Type Documentation

enum tl_errors

Valid error values used by all TLIB methods and functions.

Enumerator:
TL_NO_ERROR  Indicates that no error occured during processing. This is the default return value for most TLIB functions.
TL_ERROR  Indicates that a generic error occured.
TL_ERROR_INVALID_FORMAT  Indicates that an operation cannot be performed on the given image or object format. Either the image format conflicts with another argument, or the operation cannot be performed on this particular format. In the case of tlDigitizer, it also indicates that a particular acquisition format is not available.
TL_ERROR_GEOMETRY  Indicates that there is a geometric mismatch between the entities being processed. This typically happens when two TLIB objects with different sizes are applied a transformation.
TL_ERROR_NULL_POINTER  Indicates that an invalid pointer was used. This is typically returned when a NULL argument is given as an argument to a TLIB method.
TL_ERROR_INDEX_OUT_OF_BOUNDS  Indicates that an array is being referenced at a position bigger than its size.
TL_ERROR_MAX_REACHED  Indicates that some data has reached its maximum allowed value. This can be the number of physical devices opened at the same time, or the maximume number of features detected in a blob extraction performed by tlBlob.
TL_ERROR_ALLOCATION_FAILED  Indicates that memory allocations failed.
TL_ERROR_NOT_IMPLEMENTED  Indicates that a method or function is not currently implemented.
TL_ERROR_FILE_IO  Indicates that an error occured in a file read/write operation.
TL_ERROR_FILE_NOT_FOUND_OR_CORRUPT  Indicates that a necessary file (an image file, a library or a configuration file) is either missing or corrupt. Check the filename.
TL_ERROR_NOT_REQUIRED  Indicates that a given operation will leave the data unmodified. While it is more a warning than an actual error, it should be avoided in real-time vision programming.
TL_ERROR_NOT_FOUND  Indicates that an object or feature was not found by the correlation routines.
TL_ERROR_NOT_AVAILABLE  Indicates that an operation or feature is not available in the current context. This usually means that the function is not available for a particular implementation of a hardware interface.
TL_ERROR_NOT_IN_IMAGE  Indicates that a point is not within the image boundaries. This error can be safely ignored in most TLIB high-level methods, as these check the validity of all arguments before applying them.
TL_ERROR_STACK_OVERFLOW  Indicates that a stack overflow exception was caught. This error typically happen during a recursive call to the object recursive extraction routines (see tlObject). It is possible to prevent it by asking your compiler to increase the default stack size.
TL_ERROR_TIMEOUT  Indicates that an operation timed out. This is usually thread related (see tlThread.h)
TL_ERROR_THREAD  Indicates a thread related error (see tlThread.h)
TL_ERROR_TIMER  Indicates a timer related error (see tlTimer.h).
TL_ERROR_RESOURCE_NOT_AVAILABLE  Indicates that a hardware resource is not available. This can mean that the device is not present, is already opened, or that there is a conflict.
TL_ERROR_CONFIG_FAILED  Indicates that a hardware resource could not be configured with the given parameters.
TL_ERROR_GRAB_FAILED  Indicates that image acquisition failed. Depending on the source, it could mean that the hardware was not open or has been disconnected, or that an image (or video) file is missing.
TL_ERROR_NA  Indicates that the requested operation cannot be applied to the given arguments.


Function Documentation

void tlError ( int  errno,
const char *  str 
)

Display an error message corresponding to a given error. The error is printed on the standard output, preceded by the str argument.

Parameters:
errno the error number
str preceding string

void tlError ( int  errno  ) 

Display an error message corresponding to a given error. The error is printed on the standard output.

Parameters:
errno the error number

void tlError ( const char *  str  ) 

Display an error message corresponding to the last error that occured in the calling thread. The error is printed on the standard output, preceded by the str argument.

Parameters:
str preceding string

void tlError (  ) 

Display an error message corresponding to the last error that occured in the calling thread. The message is printed on the standard output.



TLIB documentation - generated on 7 May 2008
Please address any questions to seb@tuyphon.com
(C) 2001-2008 - S. Grange
(C) 2001-2007 - VRAI Group, EPFL
All Rights Reserved.