activemq-cpp-3.9.5
CMSException.h
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#ifndef _CMS_CMSEXCEPTION_H_
19#define _CMS_CMSEXCEPTION_H_
20
21// Includes
22#include <string>
23#include <vector>
24#include <iostream>
25#include <exception>
26
27#include <cms/Config.h>
28
29namespace cms {
30
31 class CMSExceptionData;
32
50 class CMS_API CMSException : public std::exception {
51 private:
52
53 // The actual data that defines this exception.
54 CMSExceptionData* data;
55
56 public:
57
59
61
62 CMSException(const std::string& message);
63
64 CMSException(const std::string& message, const std::exception* cause);
65
66 CMSException(const std::string& message, const std::exception* cause,
67 const std::vector<std::pair<std::string, int> >& stackTrace);
68
69 virtual ~CMSException() throw();
70
76 virtual std::string getMessage() const;
77
87 virtual const std::exception* getCause() const;
88
95 virtual std::vector< std::pair< std::string, int> > getStackTrace() const;
96
102 virtual void setMark(const char* file, const int lineNumber);
103
107 virtual void printStackTrace() const;
108
114 virtual void printStackTrace(std::ostream& stream) const;
115
121 virtual std::string getStackTraceString() const;
122
128 virtual const char* what() const throw();
129
138 virtual CMSException* clone();
139
140 private:
141
149 CMSException& operator=(const cms::CMSException&) {
150 return *this;
151 }
152
153 };
154
155}
156
157#endif /*_CMS_CMSEXCEPTION_H_*/
virtual ~CMSException()
CMSException(const std::string &message, const std::exception *cause, const std::vector< std::pair< std::string, int > > &stackTrace)
CMSException(const std::string &message)
virtual std::string getMessage() const
Gets the cause of the error.
virtual void setMark(const char *file, const int lineNumber)
Adds a file/line number to the stack trace.
virtual std::vector< std::pair< std::string, int > > getStackTrace() const
Provides the stack trace for every point where this exception was caught, marked, and rethrown.
virtual const char * what() const
Overloads the std::exception what() function to return the cause of the exception.
virtual std::string getStackTraceString() const
Gets the stack trace as one contiguous string.
virtual void printStackTrace() const
Prints the stack trace to std::err.
CMSException(const std::string &message, const std::exception *cause)
virtual const std::exception * getCause() const
Gets the exception that caused this one to be thrown, this allows for chaining of exceptions in the c...
CMSException(const CMSException &ex)
virtual CMSException * clone()
Creates a cloned version of this CMSException instance.
#define CMS_API
Definition Config.h:31
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
Definition DestinationResolver.h:23
Definition ArrayPointer.h:432
#define const
Definition zconf.h:198