version 1.55, 2002/08/20 17:39:37
|
version 1.61, 2002/09/20 20:43:28
|
|
|
| |
#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; |
} | } |
| |
| |
|
|
{ | { |
} | } |
| |
UninitializedHandleException::UninitializedHandleException() |
|
: Exception("uninitialized handle") |
|
{ |
|
} |
|
|
|
UninitializedObjectException::UninitializedObjectException() | UninitializedObjectException::UninitializedObjectException() |
: Exception("uninitialized object") | : Exception("uninitialized object") |
{ | { |
} | } |
| |
ExpectedReferenceValueException::ExpectedReferenceValueException() |
|
: Exception("Expected CIMValue object to be of type reference " |
|
"in this context") |
|
{ |
|
} |
|
|
|
MissingReferenceClassNameException::MissingReferenceClassNameException() |
|
: Exception("missing reference class name") |
|
{ |
|
} |
|
|
|
TypeMismatchException::TypeMismatchException() | TypeMismatchException::TypeMismatchException() |
: Exception("type mismatch") | : Exception("type mismatch") |
{ | { |
} | } |
| |
CIMValueInvalidTypeException::CIMValueInvalidTypeException() |
|
: Exception("invalid CIMValue type") |
|
{ |
|
} |
|
|
|
DynamicCastFailedException::DynamicCastFailedException() | DynamicCastFailedException::DynamicCastFailedException() |
: Exception("dynamic cast failed") | : Exception("dynamic cast failed") |
{ | { |
|
|
{ | { |
} | } |
| |
IncompatibleTypesException::IncompatibleTypesException() |
|
: Exception("incompatible types") |
|
{ |
|
} |
|
|
|
MalformedObjectNameException::MalformedObjectNameException( | MalformedObjectNameException::MalformedObjectNameException( |
const String& objectName) | const String& objectName) |
: Exception("malformed object name: " + objectName) | : Exception("malformed object name: " + objectName) |
|
|
{ | { |
} | } |
| |
UnexpectedFailureException::UnexpectedFailureException() |
|
: Exception("Unexpected failure") |
|
{ |
|
} |
|
|
|
AlreadyConnectedException::AlreadyConnectedException() | AlreadyConnectedException::AlreadyConnectedException() |
: Exception("already connected") | : Exception("already connected") |
{ | { |
|
|
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 |