Augments the status codes of the Alias API.
#include <AlStatusHandler.h> class AlStatusHandler static const char* statusErrorString(); static int statusErrorNumber(); static void clear(); static statusCode installHandler( \ void (*)(int, const char *) ); static statusCode removeHandler( void (*)(int, const char *) );
There are methods in the Alias API where a standard error code is used in more than one method return statement. The return value is essentially overloaded and it becomes difficult for the API developer to figure out which error condition was actually hit. This class will assist the API developer by providing a text string message whenever the overloaded return value condition is hit. This class supports retrieving the current status error string and number. Clearing the state of the status handler and installing and removing callbacks which listen to changes of state in the status handler.
Notes:
1. The AlStatusHandler::clear() method is not called by the API. It is up to the programmer to ensure that the status handler has been cleared.
2. The text messages will only be set in cases where the return value is overloaded. Therefore it is possible for an API method to fail without any change to the state of the status handler.
3. The Alias API contains many internal checks that could cause a method to return with a failure condition. In this case, an "internal error" will be returned by the status handler. This condition should be rare.
4. The AlStatusHandler::clear() method does not generate a call to a status handler callback. Therefore it can be used in a status handler callback without running into recursion problems.
5. The overloaded errors handled by this class are sFailure, sInvalidArgument and sInvalidObject.
statusCode AlStatusHandler::installHandler( void (*function)(int, const char *) )