ctkServiceException.h

Go to the documentation of this file.
00001 /*=============================================================================
00002 
00003   Library: CTK
00004 
00005   Copyright (c) 2010 German Cancer Research Center,
00006     Division of Medical and Biological Informatics
00007 
00008   Licensed under the Apache License, Version 2.0 (the "License");
00009   you may not use this file except in compliance with the License.
00010   You may obtain a copy of the License at
00011 
00012     http://www.apache.org/licenses/LICENSE-2.0
00013 
00014   Unless required by applicable law or agreed to in writing, software
00015   distributed under the License is distributed on an "AS IS" BASIS,
00016   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00017   See the License for the specific language governing permissions and
00018   limitations under the License.
00019 
00020 =============================================================================*/
00021 
00022 
00023 #ifndef CTKSERVICEEXCEPTION_H
00024 #define CTKSERVICEEXCEPTION_H
00025 
00026 #include <stdexcept>
00027 
00028 #include <QString>
00029 
00030 #include "CTKPluginFrameworkExport.h"
00031 
00032 
00033 class CTK_PLUGINFW_EXPORT ctkServiceException : public std::runtime_error
00034 {
00035 public:
00036 
00037   enum Type {
00041     UNSPECIFIED     = 0,
00045     UNREGISTERED    = 1,
00049     FACTORY_ERROR   = 2,
00053     FACTORY_EXCEPTION = 3,
00058     SUBCLASSED      = 4,
00062     REMOTE        = 5
00063   };
00064 
00065   ctkServiceException(const QString& msg, const Type& type = UNSPECIFIED, const std::exception& cause = std::exception());
00066   ctkServiceException(const QString& msg, const std::exception& cause);
00067 
00068   ctkServiceException(const ctkServiceException& o);
00069   ctkServiceException& operator=(const ctkServiceException& o);
00070 
00071   ~ctkServiceException() throw() {}
00072 
00073   std::exception getCause() const;
00074   void setCause(const std::exception&) throw(std::logic_error);
00075   Type getType() const;
00076 
00077 
00078 private:
00079 
00080   Type type;
00081   std::exception cause;
00082 
00083 };
00084 
00085 
00086 CTK_PLUGINFW_EXPORT QDebug operator<<(QDebug dbg, const ctkServiceException& exc);
00087 
00088 #endif // CTKSERVICEEXCEPTION_H
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines