RulbusError Class Reference
[Rulbus Errors]

#include <Exception.h>

Inherited by RulbusAddressError, RulbusCloseError, RulbusConfigError, RulbusContextError, RulbusDataError, RulbusHandleError, RulbusInterfaceError, RulbusOpenError, RulbusParseError, RulbusRangeError, RulbusScanError, and RulbusTimeoutError.

List of all members.


Detailed Description

For each kind of error that we want to handle, we create a class that derives from RulbusError. RulbusError provides the means to record a message that can be retrieved lateron via what() and via getLastError().

RulbusError acts for the whole library, but can only remember a single error for all threads. If the message was recorded by a another thread than the one that retrieves the message, the message returned says so. See getLastError().


Accessors

virtual CharCptr what () const
 return message.

virtual unsigned long lasttid () const
 return thread id for current message

bool getLastError (char *msg, int maxlen)
 format last error into message buffer.


Public Member Functions

Construction
 RulbusError ()
 default constructor.

 RulbusError (CharCptr fmt...)
 format a Rulbus error.

 RulbusError (StringCref string)
 set a Rulbus error.

 RulbusError (StdExceptionCref e)
 constructor taking exception& .

 RulbusError (RulbusErrorCref e)
 constructor taking RulbusError& .

virtual ~RulbusError ()
 destructor.


Private Attributes

String msg
 error message

unsigned long tid
 thread id for this error


Static Private Attributes

RulbusError theError
 save the last Rulbus error.


Member Function Documentation

bool getLastError char *  msg,
int  maxlen
[static]
 

getLastError() formats the last error into message buffer.

It copies at most maxlen characters (including the terminating \0) of the last error message into the buffer specified by msg.

Only one message is retained for all threads using the Rulbus Device Class Library. If the error message for the thread calling getLastError() is not available (anymore), the following message is returned:

[Rulbus: error message not available for this thread]

Parameters:
msg the message buffer
maxlen the size of the message buffer msg
Returns:
false, true (Ok, error)
getLastError() returns false if the message could be copied, it returns true in the following situations:
  • msg is NULL
  • maxlen is zero or less
  • the message was not available for this thread


The documentation for this class was generated from the following files:
Generated on Tue Oct 12 14:12:05 2004 for Rulbus Device Class Library for Microsoft Windows by doxygen 1.3.4