OWBI1_Exception.hpp File Reference

#include "OWBI1_config.h"
#include "OWBI1_AutoPtr.hpp"
#include <iosfwd>
#include <exception>
#include <new>

Include dependency graph for OWBI1_Exception.hpp:

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

Go to the source code of this file.

Namespaces

namespace  OWBI1
namespace  OWBI1::ExceptionDetail

Classes

class  OWBI1::Exception
 This class is the base of all exceptions thrown by OpenWBEM code. More...
class  OWBI1::ExceptionDetail::FormatMsg
struct  OWBI1::ExceptionDetail::Errno< exType >

Defines

#define OWBI1_THROW(exType, msg)   throw exType(__FILE__, __LINE__, (msg))
 Throw an exception using __FILE__ and __LINE__.
#define OWBI1_THROWL(exType, line, msg)   throw exType(__FILE__, (line), (msg))
 This macro is deprecated in 3.1.0.
#define OWBI1_THROW_SUBEX(exType, msg, subex)
 Throw an exception using __FILE__ and __LINE__.
#define OWBI1_THROW_ERR(exType, msg, err)   throw exType(__FILE__, __LINE__, (msg), (err))
 Throw an exception using __FILE__ and __LINE__.
#define OWBI1_THROW_ERRNO(exType)   OWBI1_THROW_ERRNO1(exType, errno)
 Throw an exception using __FILE__, __LINE__, errno and strerror(errno).
#define OWBI1_THROW_ERRNO1(exType, errnum)   throw ExceptionDetail::Errno< exType >::simple(__FILE__, __LINE__, (errnum))
 Throw an exception using __FILE__, __LINE__, errnum and strerror(errnum).
#define OWBI1_THROW_ERRNO_MSG(exType, msg)   OWBI1_THROW_ERRNO_MSG1(exType, (msg), errno)
 Throw an exception using __FILE__, __LINE__, errno and strerror(errno).
#define OWBI1_THROW_ERRNO_MSG1(exType, msg, errnum)
 Throw an exception using __FILE__, __LINE__, errnum and strerror(errnum).
#define OWBI1_THROW_ERR_SUBEX(exType, msg, err, subex)   throw exType(__FILE__, __LINE__, (msg), (err), &(subex))
 Throw an exception using __FILE__ and __LINE__.
#define OWBI1_DECLARE_EXCEPTION2(NAME, BASE)
 Declare a new exception class named <NAME>Exception that derives from <BASE>.
#define OWBI1_DECLARE_APIEXCEPTION2(NAME, BASE, LINKAGE_SPEC)
 Declare a new exception class named <NAME>Exception that derives from <BASE>.
#define OWBI1_DECLARE_EXCEPTION(NAME)   OWBI1_DECLARE_EXCEPTION2(NAME, ::OWBI1::Exception)
 Declare a new exception class named <NAME>Exception that derives from Exception This macro is typically used in a header file.
#define OWBI1_DECLARE_APIEXCEPTION(NAME, LINKAGE_SPEC)   OWBI1_DECLARE_APIEXCEPTION2(NAME, ::OWBI1::Exception, LINKAGE_SPEC)
 Declare a new exception class named <NAME>Exception that derives from Exception This macro is typically used in a header file.
#define OWBI1_DEFINE_EXCEPTION2(NAME, BASE)
 Define a new exception class named <NAME>Exception that derives from <BASE>.
#define OWBI1_DEFINE_EXCEPTION_WITH_BASE_AND_ID_AUX(NAME, BASE, SUB_CLASS_ID)
 Define a new exception class named <NAME>Exception that derives from <BASE>.
#define OWBI1_DEFINE_EXCEPTION(NAME)   OWBI1_DEFINE_EXCEPTION_WITH_BASE_AND_ID_AUX(NAME, ::OWBI1::Exception, ::OWBI1::Exception::UNKNOWN_SUBCLASS_ID)
 Define a new exception class named <NAME>Exception that derives from Exception.
#define OWBI1_DEFINE_EXCEPTION_WITH_ID(NAME)   OWBI1_DEFINE_EXCEPTION_WITH_BASE_AND_ID_AUX(NAME, ::OWBI1::Exception, ::OpenWBEM::ExceptionIds::NAME##ExceptionId)
 Define a new exception class named <NAME>Exception that derives from Exception.
#define OWBI1_DEFINE_EXCEPTION_WITH_BASE_AND_ID(NAME, BASE)   OWBI1_DEFINE_EXCEPTION_WITH_BASE_AND_ID_AUX(NAME, BASE, ::OpenWBEM::ExceptionIds::NAME##ExceptionId)
 Define a new exception class named <NAME>Exception that derives from <BASE>.

Functions

void OWBI1::ExceptionDetail::portable_strerror_r (int errnum, char *buf, unsigned n)
std::ostream & OWBI1::operator<< (std::ostream &os, const Exception &e)
 Writes the exception object to the stream in the form: <file>: <line> <type>: <message>.

Variables

OWBI1_OWBI1PROVIFC_API OWBI1::ExceptionDetail::FormatMsgImpl
unsigned const OWBI1::ExceptionDetail::BUFSZ = 1024


Define Documentation

#define OWBI1_DECLARE_APIEXCEPTION NAME,
LINKAGE_SPEC   )     OWBI1_DECLARE_APIEXCEPTION2(NAME, ::OWBI1::Exception, LINKAGE_SPEC)
 

Declare a new exception class named <NAME>Exception that derives from Exception This macro is typically used in a header file.

Parameters:
NAME The name of the new class (Exception will be postfixed)
LINKAGE_SPEC the linkage specifier. If the OWBI1_DEFINE_EXCEPTION is part of libopenwbem this would OWBI1_OWBI1PROVIFC_API...

Definition at line 371 of file OWBI1_Exception.hpp.

#define OWBI1_DECLARE_APIEXCEPTION2 NAME,
BASE,
LINKAGE_SPEC   ) 
 

Value:

class LINKAGE_SPEC NAME##Exception : public BASE \
{ \
public: \
   NAME##Exception(const char* file, int line, const char* msg, int errorCode = ::OWBI1::Exception::UNKNOWN_ERROR_CODE, const Exception* otherException = 0, int subClassId = ::OWBI1::Exception::UNKNOWN_SUBCLASS_ID); \
   virtual ~NAME##Exception() throw(); \
   virtual const char* type() const; \
   virtual NAME##Exception* clone() const; \
};
Declare a new exception class named <NAME>Exception that derives from <BASE>.

This macro is typically used in a header file. The exception class declaration will be prefaced with the linkage_spec parm. This allows the use of OWBI1_OWBI1PROVIFC_API when declaring exceptions. Example: OWBI1_DECLARE_APIEXCEPTION(Bogus, CIMException, OWBI1_OWBI1PROVIFC_API)

Parameters:
NAME The name of the new class (Exception will be postfixed)
BASE The base class.
LINKAGE_SPEC The linkage specifier for the exception class.

Definition at line 342 of file OWBI1_Exception.hpp.

#define OWBI1_DECLARE_EXCEPTION NAME   )     OWBI1_DECLARE_EXCEPTION2(NAME, ::OWBI1::Exception)
 

Declare a new exception class named <NAME>Exception that derives from Exception This macro is typically used in a header file.

Parameters:
NAME The name of the new class (Exception will be postfixed)

Definition at line 361 of file OWBI1_Exception.hpp.

#define OWBI1_DECLARE_EXCEPTION2 NAME,
BASE   ) 
 

Value:

class NAME##Exception : public BASE \
{ \
public: \
   NAME##Exception(const char* file, int line, const char* msg, int errorCode = ::OWBI1::Exception::UNKNOWN_ERROR_CODE, const Exception* otherException = 0, int subClassId = ::OWBI1::Exception::UNKNOWN_SUBCLASS_ID); \
   virtual ~NAME##Exception() throw(); \
   virtual const char* type() const; \
   virtual NAME##Exception* clone() const; \
};
Declare a new exception class named <NAME>Exception that derives from <BASE>.

This macro is typically used in a header file.

Parameters:
NAME The name of the new class (Exception will be postfixed)
BASE The base class.

Definition at line 321 of file OWBI1_Exception.hpp.

#define OWBI1_DEFINE_EXCEPTION NAME   )     OWBI1_DEFINE_EXCEPTION_WITH_BASE_AND_ID_AUX(NAME, ::OWBI1::Exception, ::OWBI1::Exception::UNKNOWN_SUBCLASS_ID)
 

Define a new exception class named <NAME>Exception that derives from Exception.

The new class will use UNKNOWN_SUBCLASS_ID for the subclass id. Use this macro for internal implementation exceptions that don't have an id. This macro is typically used in a cpp file.

Parameters:
NAME The name of the new class (Exception will be postfixed)

Definition at line 412 of file OWBI1_Exception.hpp.

#define OWBI1_DEFINE_EXCEPTION2 NAME,
BASE   ) 
 

Value:

NAME##Exception::NAME##Exception(const char* file, int line, const char* msg, int errorCode, const ::OWBI1::Exception* otherException, int subClassId) \
   : BASE(file, line, msg, errorCode, otherException, subClassId) {} \
NAME##Exception::~NAME##Exception() throw() { } \
NAME##Exception* NAME##Exception::clone() const { return new(std::nothrow) NAME##Exception(*this); } \
const char* NAME##Exception::type() const { return #NAME "Exception"; }
Define a new exception class named <NAME>Exception that derives from <BASE>.

The new class will use UNKNOWN_SUBCLASS_ID for the subclass id. This macro is typically used in a cpp file.

Parameters:
NAME The name of the new class (Exception will be postfixed)
BASE The base class.

Definition at line 381 of file OWBI1_Exception.hpp.

#define OWBI1_DEFINE_EXCEPTION_WITH_BASE_AND_ID NAME,
BASE   )     OWBI1_DEFINE_EXCEPTION_WITH_BASE_AND_ID_AUX(NAME, BASE, ::OpenWBEM::ExceptionIds::NAME##ExceptionId)
 

Define a new exception class named <NAME>Exception that derives from <BASE>.

The new class will use ExceptionIds::<NAME>ExceptionId for the subclass id. Use this macro to create public exceptions that have an id in the OWBI1::ExceptionIds namespace that will derive from BASE This macro is typically used in a cpp file.

Parameters:
NAME The name of the new class (Exception will be postfixed)
BASE The base class.

Definition at line 433 of file OWBI1_Exception.hpp.

#define OWBI1_DEFINE_EXCEPTION_WITH_BASE_AND_ID_AUX NAME,
BASE,
SUB_CLASS_ID   ) 
 

Value:

NAME##Exception::NAME##Exception(const char* file, int line, const char* msg, int errorCode, const ::OWBI1::Exception* otherException, int subClassId) \
   : BASE(file, line, msg, errorCode, otherException, subClassId == ::OWBI1::Exception::UNKNOWN_SUBCLASS_ID ? (SUB_CLASS_ID) : subClassId) {} \
NAME##Exception::~NAME##Exception() throw() { } \
NAME##Exception* NAME##Exception::clone() const { return new(std::nothrow) NAME##Exception(*this); } \
const char* NAME##Exception::type() const { return #NAME "Exception"; }
Define a new exception class named <NAME>Exception that derives from <BASE>.

The new class will use SUB_CLASS_ID for the subclass id. This macro is typically used in a cpp file.

Parameters:
NAME The name of the new class (Exception will be postfixed)
BASE The base class.
SUB_CLASS_ID The subclass id.

Definition at line 397 of file OWBI1_Exception.hpp.

#define OWBI1_DEFINE_EXCEPTION_WITH_ID NAME   )     OWBI1_DEFINE_EXCEPTION_WITH_BASE_AND_ID_AUX(NAME, ::OWBI1::Exception, ::OpenWBEM::ExceptionIds::NAME##ExceptionId)
 

Define a new exception class named <NAME>Exception that derives from Exception.

The new class will use ExceptionIds::<NAME>ExceptionId for the subclass id. Use this macro to create public exceptions that have an id in the OWBI1::ExceptionIds namespace that derive from Exception This macro is typically used in a cpp file.

Parameters:
NAME The name of the new class (Exception will be postfixed)

Definition at line 422 of file OWBI1_Exception.hpp.

#define OWBI1_THROW exType,
msg   )     throw exType(__FILE__, __LINE__, (msg))
 

Throw an exception using __FILE__ and __LINE__.

If applicable, OWBI1_THROWBI1_ERR should be used instead of this macro.

Parameters:
exType The type of the exception
msg The exception message. A string that will be copied.

Definition at line 244 of file OWBI1_Exception.hpp.

Referenced by OWBI1::_ResolveProperty(), OWBI1::WQLCompile::_ResolveProperty(), OWBI1::badDateTime(), OWBI1::CIMValueCast::castValueToDataType(), OWBI1::WQLSelectStatement::evaluateWhereClause(), OWBI1::WQLOperand::getBooleanValue(), OWBI1::WQLOperand::getDoubleValue(), OWBI1::WQLOperand::getIntegerValue(), OWBI1::CIMObjectPath::getKeyT(), OWBI1::WQLOperand::getPropertyName(), OWBI1::CIMProperty::getQualifierT(), OWBI1::WQLOperand::getStringValue(), OWBI1::CIMQualifier::getValueT(), OWBI1::CIMProperty::getValueT(), OWBI1::DateTime::localTimeAndOffset(), OWBI1::TempFileEnumerationImplBase::readSize(), OWBI1::TempFileEnumerationImplBase::releaseFile(), OWBI1::DateTime::set(), OWBI1::DateTime::setMicrosecond(), OWBI1::DateTime::setMonth(), OWBI1::DateTime::setTime(), OWBI1::TempFileEnumerationImplBase::TempFileEnumerationImplBase(), OWBI1::TempFileEnumerationImplBase::throwIfEmpty(), and OWBI1::throwStringConversion().

#define OWBI1_THROW_ERR exType,
msg,
err   )     throw exType(__FILE__, __LINE__, (msg), (err))
 

Throw an exception using __FILE__ and __LINE__.

Parameters:
exType The type of the exception
msg The exception message. A string that will be copied.
err The error code.

Definition at line 268 of file OWBI1_Exception.hpp.

Referenced by OWBI1::CIMInstance::getPropertyT(), and OWBI1::CIMBase::readSig().

#define OWBI1_THROW_ERR_SUBEX exType,
msg,
err,
subex   )     throw exType(__FILE__, __LINE__, (msg), (err), &(subex))
 

Throw an exception using __FILE__ and __LINE__.

Parameters:
exType The type of the exception
msg The exception message. A string that will be copied.
err The error code.
subex A sub-exception. A point to it will be passed to the exception constructor, which should clone() it.

Definition at line 311 of file OWBI1_Exception.hpp.

#define OWBI1_THROW_ERRNO exType   )     OWBI1_THROW_ERRNO1(exType, errno)
 

Throw an exception using __FILE__, __LINE__, errno and strerror(errno).

Parameters:
exType The type of the exception; ctor must take file, line, message, and error code.

Definition at line 276 of file OWBI1_Exception.hpp.

#define OWBI1_THROW_ERRNO1 exType,
errnum   )     throw ExceptionDetail::Errno< exType >::simple(__FILE__, __LINE__, (errnum))
 

Throw an exception using __FILE__, __LINE__, errnum and strerror(errnum).

Parameters:
exType The type of the exception; ctor must take file, line, message, and error code.

Definition at line 283 of file OWBI1_Exception.hpp.

#define OWBI1_THROW_ERRNO_MSG exType,
msg   )     OWBI1_THROW_ERRNO_MSG1(exType, (msg), errno)
 

Throw an exception using __FILE__, __LINE__, errno and strerror(errno).

Parameters:
exType The type of the exception; ctor must take file, line, message, and error code.

Definition at line 291 of file OWBI1_Exception.hpp.

#define OWBI1_THROW_ERRNO_MSG1 exType,
msg,
errnum   ) 
 

Value:

throw ExceptionDetail::Errno< exType >:: \
      format(__FILE__, __LINE__, (msg), (errnum))
Throw an exception using __FILE__, __LINE__, errnum and strerror(errnum).

Parameters:
exType The type of the exception; ctor must take file, line, message, and error code.

Definition at line 299 of file OWBI1_Exception.hpp.

#define OWBI1_THROW_SUBEX exType,
msg,
subex   ) 
 

Value:

throw exType(__FILE__, __LINE__, (msg), \
             ::OWBI1::Exception::UNKNOWN_ERROR_CODE, &(subex))
Throw an exception using __FILE__ and __LINE__.

Parameters:
exType The type of the exception
msg The exception message. A string that will be copied.
subex A sub-exception. A pointer to it will be passed to the exception constructor, which should clone() it.

Definition at line 258 of file OWBI1_Exception.hpp.

#define OWBI1_THROWL exType,
line,
msg   )     throw exType(__FILE__, (line), (msg))
 

This macro is deprecated in 3.1.0.

Definition at line 249 of file OWBI1_Exception.hpp.


Generated on Thu Feb 9 09:09:54 2006 for openwbem by  doxygen 1.4.6