version 1.58, 2002/09/11 21:58:02
|
version 1.62.2.1, 2003/02/06 20:47:03
|
|
|
// Carol Ann Krug Graves, Hewlett-Packard Company | // Carol Ann Krug Graves, Hewlett-Packard Company |
// (carolann_graves@hp.com) | // (carolann_graves@hp.com) |
// Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com) | // Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com) |
|
// Sushma Fernandes , Hewlett-Packard Company |
|
// (sushma_fernandes@hp.com) |
// | // |
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
#include <cstdio> | #include <cstdio> |
#include "Exception.h" | #include "Exception.h" |
|
#include <Pegasus/Common/ExceptionRep.h> |
#include <Pegasus/Common/CIMExceptionRep.h> | #include <Pegasus/Common/CIMExceptionRep.h> |
#include "Tracer.h" | #include "Tracer.h" |
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
Exception::Exception(const String& message) : _message(message) |
Exception::Exception(const String& message) |
|
{ |
|
_rep = new ExceptionRep(); |
|
_rep->message = message; |
|
} |
|
|
|
Exception::Exception(const Exception& exception) |
|
{ |
|
_rep = new ExceptionRep(); |
|
_rep->message = exception._rep->message; |
|
} |
|
|
|
Exception::Exception() |
{ | { |
} | } |
| |
Exception::~Exception() | Exception::~Exception() |
{ | { |
|
delete _rep; |
} | } |
| |
const String& Exception::getMessage() const | const String& Exception::getMessage() const |
{ | { |
return _message; |
return _rep->message; |
} | } |
| |
| |
|
|
{ | { |
} | } |
| |
InvalidTypeException::InvalidTypeException() |
|
: Exception("invalid CIM type") |
|
{ |
|
} |
|
|
|
DynamicCastFailedException::DynamicCastFailedException() | DynamicCastFailedException::DynamicCastFailedException() |
: Exception("dynamic cast failed") | : Exception("dynamic cast failed") |
{ | { |
|
|
{ | { |
} | } |
| |
|
DateTimeOutOfRangeException::DateTimeOutOfRangeException(const String& message) |
|
: Exception("DateTime is out of range : " + message) |
|
{ |
|
} |
|
|
|
|
|
ObjectBusyException::ObjectBusyException(const String & message) |
|
: Exception("Object is busy: " + message) |
|
{ |
|
} |
|
|
| |
//////////////////////////////////////////////////////////////////////////////// | //////////////////////////////////////////////////////////////////////////////// |
// | // |
|
|
CIMException::CIMException( | CIMException::CIMException( |
CIMStatusCode code, | CIMStatusCode code, |
const String& message) | const String& message) |
: |
: Exception() |
Exception(message) |
|
{ | { |
_rep = new CIMExceptionRep(); |
CIMExceptionRep * tmp = new CIMExceptionRep (); |
_rep->code = code; |
tmp->message = message; |
_rep->file = ""; |
tmp->code = code; |
_rep->line = 0; |
tmp->file = ""; |
|
tmp->line = 0; |
|
_rep = tmp; |
} | } |
| |
CIMException::CIMException(const CIMException & cimException) | CIMException::CIMException(const CIMException & cimException) |
: Exception(cimException.getMessage()) |
: Exception() |
{ | { |
_rep = new CIMExceptionRep(); |
CIMExceptionRep * tmp = new CIMExceptionRep (); |
_rep->code = cimException._rep->code; |
CIMExceptionRep * rep; |
_rep->file = cimException._rep->file; |
rep = reinterpret_cast<CIMExceptionRep*>(cimException._rep); |
_rep->line = cimException._rep->line; |
tmp->message = rep->message; |
|
tmp->code = rep->code; |
|
tmp->file = rep->file; |
|
tmp->line = rep->line; |
|
_rep = tmp; |
} | } |
| |
CIMException& CIMException::operator=(const CIMException & cimException) | CIMException& CIMException::operator=(const CIMException & cimException) |
{ | { |
_message = cimException._message; |
CIMExceptionRep* left; |
_rep->code = cimException._rep->code; |
CIMExceptionRep* right; |
_rep->file = cimException._rep->file; |
left = reinterpret_cast<CIMExceptionRep*>(this->_rep); |
_rep->line = cimException._rep->line; |
right = reinterpret_cast<CIMExceptionRep*>(cimException._rep); |
|
left->message = right->message; |
|
left->code = right->code; |
|
left->file = right->file; |
|
left->line = right->line; |
return *this; | return *this; |
} | } |
| |
CIMException::~CIMException() | CIMException::~CIMException() |
{ | { |
delete _rep; |
|
} | } |
| |
CIMStatusCode CIMException::getCode() const | CIMStatusCode CIMException::getCode() const |
{ | { |
return _rep->code; |
CIMExceptionRep* rep; |
|
rep = reinterpret_cast<CIMExceptionRep*>(_rep); |
|
return rep->code; |
} | } |
| |
PEGASUS_NAMESPACE_END | PEGASUS_NAMESPACE_END |