![]() |
ROC SDK
2.4.0
Scalable Face Recognition Software
|
Handling errors. More...
Macros | |
| #define | ROC_ATTEMPT(EXPRESSION) |
| A simple return-error-message error handling macro. More... | |
Typedefs | |
| typedef const char * | roc_error |
| A printable error string. More... | |
| typedef void(* | roc_log_callback) (const char *) |
| Pointer to a callback function used to forward roc_log activity. More... | |
Functions | |
| void | roc_ensure (roc_error error) |
| A simple log-and-exit error handling function. More... | |
| roc_error | roc_set_logging (bool stdout_, const char *filename, roc_log_callback callback) |
| Set application logging. More... | |
| bool | roc_log (const char *message) |
| Write a message to the logging infrastructure previously established by roc_set_logging. More... | |
| bool | roc_log_no_callback (const char *message) |
| Write a message to the logging infrastructure previously established by roc_set_logging. More... | |
Handling errors.
All ROC functions return a printable roc_error message by design. The ROC_ATTEMPT macro and roc_ensure function are provided as basic error handling methods.
| #define ROC_ATTEMPT | ( | EXPRESSION | ) |
A simple return-error-message error handling macro.
| typedef const char* roc_error |
A printable error string.
All functions in the ROC API return a roc_error. A value of NULL indicates success, and all other values indicate failure.
| typedef void(* roc_log_callback) (const char *) |
Pointer to a callback function used to forward roc_log activity.
The function should return void and take one parameter: a const char* message.
The message is only valid for the lifetime of the callback function.
| void roc_ensure | ( | roc_error | error | ) |
A simple log-and-exit error handling function.
| [in] | error | Error return value from a ROC API function call. |
| roc_error roc_set_logging | ( | bool | stdout_, |
| const char * | filename, | ||
| roc_log_callback | callback | ||
| ) |
Set application logging.
For log file rotation, filename can include any of the expansions supported by strftime which will be substituted at runtime with the current date and time each occasion a log entry is written.
| [in] | stdout_ | Print messages to STDOUT. |
| [in] | filename | Optional log file path to write messages to, or NULL. Log files are opened in append mode. An empty string will be treated as NULL. |
| [in] | callback | Optional callback function to forward messages to, or NULL. |
| bool roc_log | ( | const char * | message | ) |
Write a message to the logging infrastructure previously established by roc_set_logging.
If message is NULL, or roc_set_logging has not been called, this function is a no-op and returns false.
| [in] | message | Message to log. |
true if message was logged, false otherwise. | bool roc_log_no_callback | ( | const char * | message | ) |
Write a message to the logging infrastructure previously established by roc_set_logging.
An alternative to roc_log to explicitly avoid triggering roc_log_callback.
| [in] | message | Message to log. |
true if message was logged, false otherwise.
1.8.15